RosettaCodeData/Task/Rot-13/Liberty-BASIC/rot-13-2.basic

13 lines
400 B
Plaintext

Function Rot13$(t$)
for i = 1 to len(t$)
ch$=mid$(t$,i,1)
if (asc(ch$)>=asc("A")) and (asc(ch$)<=asc("Z")) then
ch$=chr$(asc("A")+ (asc(ch$)-asc("A")+13) mod 26)
end if
if (asc(ch$)>=asc("a")) and (asc(ch$)<=asc("z")) then
ch$=chr$(asc("a")+ (asc(ch$)-asc("a")+13) mod 26)
end if
Rot13$=Rot13$+ch$
next
end function