• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Init Caps Handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Init Caps Handler
      • From: Philip Aker <email@hidden>
    • Re: Init Caps Handler
      • From: Skeeve <email@hidden>
References: 
 >Init Caps Handler (From: Oakley Masten <email@hidden>)

  • Prev by Date: Re: Init Caps Handler
  • Next by Date: Re: Init Caps Handler
  • Previous by thread: Re: Init Caps Handler
  • Next by thread: Re: Init Caps Handler
  • Index(es):
    • Date
    • Thread