Function Kata „ROT-13“
Implement a function that encodes a text by [ROT-13].
The ROT-13 coding exchanges every character by the character 13 positions further back in the alphabet. If the value lies behind the end of the alphabet it is fetched from the beginning.
Hello, World -> URYYB, JBEYQ
An „e“ gets to an „R“ and a „W“ gets to a „J“. Lower case letters are translated to upper case.
German “Umlaute” need to be replaced by the following character combinations before the coding: „Ö“ = „OE“, „Ä“ = „AE“, „Ü“ = „UE“, „ß“ = „SS“.
Characters that are no letters are not encoded.
The offset (13 in this case) should be variable.
Encode digits also. Digits and letters should form a unit: 0123456789ABCDEFGH…XYZ.
With offset 13 the „0“ gets to a „D“ and a „Z“ doesn’t get to an „M“ but to a „C“.
“I am the founder of Majer Consulting and Majer Training and an experienced software developer, trainer and consultant. I have been on the road in the SAP world since 1998, supporting numerous projects, and have developed a passion for software engineering, software testing and agile development methods such as TDD. When I am not servicing customers or holding seminars, I am speaking at conferences or writing my next book.”