Here's my go at it:
rot13: func [s [string!] /local result top][
result: copy s
repeat n length? s [
top: either s/:n >= #"a" [97][65] ; determine upper or lowercase
if (i: s/:n - top) < 26 [ ; only 26 letters in alphabet affected
On Sunday 12 October 2003 04:42 am, you wrote:
> Hello Karl Robillard (krobillard),
>
> Your Version is very Small but not a fully ROT13!
> Rot13 may only convert a - z A - Z
> Your version also converts anyother character (byte) too, so it wont work
> on binary strings..
Norman,
I don't think
> A honarable listing on the one that builds the smallest ROT13 using
bitsets and parsing ;-)
Compact but obscure.
rot13: func [
string [string!] /local non-letter p
] [
non-letter: negate charset [#"a" - #"z" #"A" - #"Z"]
parse/all/case string: copy string [
any [
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"]