ruby_drills icon indicating copy to clipboard operation
ruby_drills copied to clipboard

Are multiple alternate solutions acceptable?

Open kytrinyx opened this issue 12 years ago • 0 comments

@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

kytrinyx avatar Jan 24 '14 13:01 kytrinyx