View/Edit #111:rot

Switch to edit mode.

Name(s): rot
1:  "Rotates the alphabetic characters in a string by n positions."
2:  "e.g. $crypt_utils:rot('Hello!', 13) => 'Uryyb!'"
3:  {text, n} = args
4:  key = $su.alphabet + $su.alphabet + $su:uppercase($su.alphabet + $su.alphabet)
5:  n = (n % 26 + 26) % 26
6:  for x in [1..length(text)]
7:    char = text[x]
8:    where = index(key, char, 1)
9:    if (where)
10:     char = key[where + n]
11:   endif
12:   text[x] = char
13:   $command_utils:suspend_if_needed()
14: endfor
15: return text
16: "Last modified by Dax (#789) on Mon Aug 14 08:44:16 2000 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Hacker (#60)

You are not logged in.

[home | help | who | search | setup | code]