Here is a more terse way to express ROT-13
FUNCTION STRING Rot13(STRING s)
STRING t
IFZ s THEN RETURN ""
t = s
FOR i = 0 TO UBOUND(t)
c = t{i} : t{i} = c +
13*(-(c>64)+2*(c>77)-(c>90)-(c>96)+2*(c>109)-(c>122))
NEXT i
RETURN t
END FUNCTION
Another way is to clear bit 5 of the character, thus converting from
lower to upper case, do the above using only 3 indicator functions
instead of 6, then put bit 5 back(if necessary), but this takes 2 extra
lines of code.
Vic
For some character whose ASCII value is c, and for some point n, the
expression (-(c>=n)) is 0 for 0...(n-1) and 1 for n...255. Since what we
need is something which makes no change up to 64, then adds 13 for
65-77, subtracts 13 for 78-90, etc., it was just a case of picking the
various n values required, then simplifying by noting that (-(c>=n)) is
the same as (-(c>(n-1))).
Vic