RosettaCodeData/Task/Rot-13/BASIC256/rot-13.basic256

22 lines
401 B
Plaintext

# rot13.bas
# basic256 1.1.4.0
iOffset = 13
input "> ", str$
str$ = upper(str$) # a bit of a cheat however old school encryption is always upper case
len = length(str$)
for i = 1 to len
iTemp = asc(mid(str$,i,1))
if iTemp > 64 AND iTemp < 91 then
iTemp = ((iTemp - 65) + iOffset) % 26
print chr(iTemp + 65);
else
print chr(iTemp);
end if
next i