ruby_drills
ruby_drills copied to clipboard
Are multiple alternate solutions acceptable?
@value = "bobcat"Remove 'bob' from this string in order to return a much tamer version.
Use a non-destructive method to remove 'bob' from this string and return "cat":
>> @value.sub("bob", "")
Not yet...
I would expect any of these (and more) to work:
-
@value.sub("bob", "") -
@value.gsub("bob", "") -
@value.tr("bo", "") -
@value[3..-1] -
@value.gsub(/[bo]/, '') - etc