Re: change case script
Re: change case script
- Subject: Re: change case script
- From: Emmanuel <email@hidden>
- Date: Fri, 2 Nov 2001 20:03:37 +0100
At 18:53 +0100 2/11/01, Marc K. Myers wrote:
>
Here's a very fast handler that converts any set of characters to another:
>
>
property oldChars : {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
>
[optn-L]
>
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", [optn-L]
>
"U", "V", "W", "X", "Y", "Z", " "}
>
property newChars : {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
>
[optn-L]
>
"k", "l", "m", "n", "o", "p", "q", "r", "s", "t", [optn-L]
>
"u", "v", "w", "x", "y", "z", "_"}
>
[...]
>
set AppleScript's text item delimiters to (item i of oldChars)
>
set theText to text items of theText
>
set AppleScript's text item delimiters to (item i of newChars)
Works fine!
One may want to make the code more compact by using strings instead of lists:
property oldChars :"ABCDEFGHIJKLMNOPQRSTUVWXYZ "
property newChars : "abcdefghijklmnopqrstuvwxyz_"
[...]
set AppleScript's text item delimiters to (character i of oldChars)
set theText to text items of theText
set AppleScript's text item delimiters to (character i of newChars)
Emmanuel