22 lines
538 B
Plaintext
22 lines
538 B
Plaintext
function ROT13 (InputTxt as string) as string
|
|
dim i as integer, ascVal as byte
|
|
Result = ""
|
|
|
|
for i = 1 to len(InputTxt)
|
|
ascVal = asc(InputTxt[i])
|
|
|
|
select case ascVal
|
|
case 65 to 77, 97 to 109
|
|
Result = Result + chr$(ascVal + 13)
|
|
case 78 to 90, 110 to 122
|
|
Result = Result + chr$(ascVal - 13)
|
|
case else
|
|
Result = Result + chr$(ascVal)
|
|
end select
|
|
next
|
|
end function
|
|
|
|
Input "Text to encode: "; a$
|
|
Print ROT13(a$)
|
|
Input "Press a key to end..."; a$
|