Rot-13: Difference between revisions

→‎{{header|S-BASIC}}: added additional approach
imported>Sboeka
m (C# program did not compile due 'message' not existing)
imported>KayproKid
(→‎{{header|S-BASIC}}: added additional approach)
Line 5,637:
Restored : The quick brown fox jumps over the lazy red dog.
</pre>
 
Still a third approach makes use of S-BASIC's awkward (and probably little-used) XLATE function, which transforms each character in the input string by using its ASCII value as an index into the translation string.
<syntaxhighlight lang = "basic">
var s, tr = string:127
 
rem - set up the translation string
tr = space$(31) + " !" + chr(34) + "#$%&'()*+,-./0123456789"
tr = tr + ":;<=>?@NOPQRSTUVWXYZABCDEFGHIJKLM[\]^_`"
tr = tr + "nopqrstuvwxyzabcdefghijklm{|}~"
 
s = "The quick brown fox jumps over the lazy dog."
print "Plain text: "; s
s = xlate(s,tr)
print "Rotated : "; s
s = xlate(s,tr)
print "Restored : "; s
 
end
</syntaxhighlight>
 
=={{header|S-lang}}==
Anonymous user