enter a string as the argument to []=, and it will return the new, corrected string, if found; nil otherwise. : String Range « String « Ruby






enter a string as the argument to []=, and it will return the new, corrected string, if found; nil otherwise.


speaker = "this is a test, 2007"
speaker[", 2007"]= "III" # => "III"
p speaker 

 








Related examples in the same category

1.enter a range to indicate a range of characters you want to change. Include the last character with two dots (..)
2.Get substring from a string object
3.Getting the Parts of a String You Want
4.String range with string.length
5.Generating a Succession of Strings
6.Change a string with range