RosettaCodeData/Task/Rot-13/Wart/rot-13-1.wart
2016-12-05 23:44:36 +01:00

14 lines
324 B
Text

def (rot13 s)
(as string
(map rot13
(as list s)))
Alphabet <- "abcdefghijklmnopqrstuvwxyz"
def (rot13 c) :case (and string?.c len.c=1)
if ("a" <= c <= "z")
let idx (pos c Alphabet)
Alphabet (idx+13 % 26)
("A" <= c <= "Z")
(downcase.c -> rot13 -> upcase)
:else
c