Replace first vowel with an asterisk : index « String « Ruby






Replace first vowel with an asterisk


s = "hello"       

s[/[aeiou]/] = '*'      # Replace first vowel with an asterisk

 








Related examples in the same category

1.The index method returns the index location of a matching substring.
2.line[line.index("k")]
3.Index and last index a pattern