Write a Ruby program to remove a character from a given string if it starts with that specified character
my_string = "JJavaScript" print my_string.sub!(/^J/, '') my_string = "PPHP" print "\n",my_string.sub!(/^P/, '')
Output:
JavaScript PHP
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer