RosettaCodeData/Task/Rot-13/MiniScript/rot-13.mini

13 lines
355 B
Plaintext

rot13 = function(s)
chars = s.values
for i in chars.indexes
c = chars[i]
if c >= "a" and c <= "z" then chars[i] = char(97 + (code(c)-97+13)%26)
if c >= "A" and c <= "Z" then chars[i] = char(65 + (code(c)-65+13)%26)
end for
return chars.join("")
end function
print rot13("Hello world!")
print rot13("Uryyb jbeyq!")