Translation from one set of characters to another : tr « String « Ruby






Translation from one set of characters to another


puts "hello".tr("aeiou", "AEIOU")  # => "hEllO": capitalize vowels. Also tr!
puts "hello".tr("aeiou", " ")      # => "h ll ": convert vowels to spaces

 

Related examples in the same category

1.tr method from string