Re: Aplescript for changing case (again)
Re: Aplescript for changing case (again)
- Subject: Re: Aplescript for changing case (again)
- From: cris <email@hidden>
- Date: Wed, 10 Jan 2001 03:37:50 +0100
on 09.01.2001 22:54 Uhr, Arthur J Knapp at email@hidden wrote:
>
Yeah. The "Essential Routines" module from Apple is nice, and
>
very clearly written, but Richard 23's implementation contains
>
all the current *best thinking* on vanilla case conversion.
Indeed, very nice thing! I changed it a bit so we can now choose to lower
or to uppercase the text. I removed also the properties, making it more
independent. I hope Richard 23 will not hang me.
ChangeCase("HEllO DoodS!", false)
--> "hello doods!"
on ChangeCase(theString, UpperCaseF)
if UpperCaseF then
set {ABC, xyz} to {"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
else
set {xyz, ABC} to {"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
end if
--
tell (a reference to AppleScript's text item delimiters)
set contents to ""
set theString to theString as string
repeat with thePosition from 1 to 26
if theString contains (ABC's item thePosition) then
set {contents} to {ABC's item thePosition}
set {contents} to {xyz's item thePosition, theString's text items}
set theString to result's end as string
end if
end repeat
set {contents} to {""}
return theString
end tell
end ChangeCase
Greetings
cris