[Solved] What is za and what is next


String#tr allows c1-c2 as a shorthand notation for a range of characters:

  • a-z expands to abcdefghijklmnopqrstuvwxyz
  • b-z expands to bcdefghijklmnopqrstuvwxyz
  • b-za is b-z followed by a single a, i.e. bcdefghijklmnopqrstuvwxyza

Finally s.tr!('a-z', 'b-za') replaces each letter by the next one in the alphabet using this mapping:

from_str: abcdefghijklmnopqrstuvwxyz
to_str:   bcdefghijklmnopqrstuvwxyza

solved What is za and what is next