Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: pleac - rot13

From: antonr:iinet:au at: 14-Oct-2003 17:25

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 i: i + 13 // 26 ; perform rot13 poke result n to-char top + i ; insert new letter ] ] result ] Hmm, maybe we need a rot13 compiler to generate the long strings accurately ? :) Anton.