Re: Init Caps Handler
Re: Init Caps Handler
- Subject: Re: Init Caps Handler
- From: Paul Scott <email@hidden>
- Date: Tue, 20 Nov 2007 15:28:08 -0800
On Nov 20, 2007, at 12:57 PM, Oakley Masten wrote:
While I'm at it how about "All Caps" and "No Caps"?
Sorry, the previous version got mangled by my retab routine;
Here it is again (corrected):
on InitCaps for aString
set s to ""
set ws to 1
repeat with c in (aString as string)
if ((ASCII number c) ≤ 32) then
set ws to 1
else
if ws is 1 then
if (((ASCII number c) ≥ (ASCII number "a")) and
((ASCII number c) ≤ (ASCII number "z"))) then
set c to ASCII character ((ASCII number c) - 32)
end if
else if (((ASCII number c) ≥ (ASCII number "A")) and
((ASCII number c) ≤ (ASCII number "Z")))
set c to ASCII character ((ASCII number c) + 32)
end if
set ws to 0
end if
set s to s & c
end repeat
return s
end InitCaps
on AllCaps for aString
set s to ""
repeat with c in (aString as string)
if (((ASCII number c) ≥ (ASCII number "a")) and ((ASCII
number c) ≤ (ASCII number "z"))) then
set c to ASCII character ((ASCII number c) - 32)
end if
set s to s & c
end repeat
return s
end AllCaps
on NoCaps for aString
set s to ""
repeat with c in (aString as string)
if (((ASCII number c) ≥ (ASCII number "A")) and ((ASCII
number c) ≤ (ASCII number "Z"))) then
set c to ASCII character ((ASCII number c) + 32)
end if
set s to s & c
end repeat
return s
end NoCaps
set answer to text returned of (display dialog "Enter text" default
answer "")
display dialog ("AllCaps \"" & (AllCaps for answer) & "\"")
display dialog ("NoCaps \"" & (NoCaps for answer) & "\"")
display dialog ("InitCaps \"" & (InitCaps for answer) & "\"")
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden