Re: Rot 13
Re: Rot 13
- Subject: Re: Rot 13
- From: Paul Skinner <email@hidden>
- Date: Mon, 02 Jul 2001 00:01:09 -0400
on 7/1/01 9:22 PM, Michelle Steiner wrote:
>
Can anyone come up with a better way than the following to impliment
>
rot13 in Applescript? I tried to figure out a way to do it with TIDs,
>
but I haven't been able to figure that out.
>
>
--Michelle
Snip rot13 script
Not my code. Sorry I don't have the author's name recorded.
The rot13 text given in the call is a clue.
on ROT13(theTEXT)
--on ROT13(theTEXT)
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" & "abcdefghijklmnopqrstuvwxyz"
set alphabets to result
"NOPQRSTUVWXYZ" & "ABCDEFGHIJKLM" & "nopqrstuvwxyz" & "abcdefghijklm"
set rotAlphabets to result
----------
set theTEXT to items of theTEXT
set sentinal to ASCII character 1 -- (sentinal & character) == not
processed
set text item delimiters to {sentinal}
set theTEXT to sentinal & theTEXT as string -- all unprocessed
repeat with x from 1 to (26 + 26)
set text item delimiters to {sentinal & item x of alphabets}
set theTEXT to text items of theTEXT
set text item delimiters to {item x of rotAlphabets}
set theTEXT to theTEXT as string
end repeat
-- clean up
set text item delimiters to {sentinal}
set theTEXT to text items of theTEXT
set text item delimiters to {""}
return theTEXT as string
--end ROT13
end ROT13
ROT13("Trbetr Yhpnf vf n zrqvbper gnyrag jub tbg ernyyl yhpxl jvgu Fgne
Jnef.")
--
"AppleScript is digital duct tape."
Paul Skinner
References: | |
| >Rot 13 (From: Michelle Steiner <email@hidden>) |