Tip In Ruby, a return keyword is not always needed. A single-statement method will automatically treat the statement as a return value.
Tip 2 The tr method can receive character ranges, like a regular expression. So the code "a-z" means the entire lowercase alphabet.
# Use expanded syntax in tr.
# Use range syntax with tr.
return value.tr("a-z", "n-za-m")
# Use rot13 methods.
Summary. ROT13 is easy to reverse. It is helpful to implement ROT13 in computer languages to learn how to manipulate strings. Often, languages contain helpful translate methods like tr.
Dot Net Perls is a collection of tested code examples. Pages are continually updated to stay current, with code correctness a top priority.
Sam Allen is passionate about computer languages. In the past, his work has been recommended by Apple and Microsoft and he has studied computers at a selective university in the United States.