[REBOL] Re: pleac/rot13
From: joel:neely:fedex at: 12-Oct-2003 7:54
Hi, Norman,
Here's one way, but I don't know about smallness...
Rebolinth wrote:
> A honarable listing on the one that builds the smallest ROT13 using bitsets and parsing
;-)
>
r13: func [s [string!] /local left right neither r13char c] [
left: charset [#"a" - #"m" #"A" - #"M"]
right: charset [#"n" - #"z" #"N" - #"Z"]
neither: complement union left right
r13char: [
[ copy c left (c: +13 + to-char c)
| copy c right (c: -13 + to-char c)
| copy c neither]
(prin to-char c)
]
parse s [any r13char]
]
-jn-