0
What is the keyword to replace an object in 'Ruby'? As in Python it's "replace".
2 Respostas
+ 7
puts("aaa".gsub("a","b"))
#bbb
+ 5
"nine zero zero".gsub("zero","nine")
#nine nine nine
"nine zero zero".sub("zero","nine")
#nine nine zero
#replaces only first occuring String