Ruby/String/tr

Материал из Wiki.crossplatform.ru

(Различия между версиями)
Перейти к: навигация, поиск
м (1 версия: Импорт выборки материалов по Ruby)
 

Текущая версия на 17:55, 13 сентября 2010

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



tr method from string

"LOWERCASE ALL VOWELS".tr("AEIOU", "aeiou")