String .tr ruby code example
Example 1: .tr in ruby
# if wana transform a to n, b to m, c to o
messages.map { |c| c.tr("a-z", "n-za-m") }
Example 2: ruby string trmi
>> @title = "abc"
=> "abc"
>> @title.strip!
=> nil
>> @title
=> "abc"
>> @title = " abc "
=> " abc "
>> @title.strip!
=> "abc"
>> @title
=> "abc"