• 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: Considering case...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Considering case...


  • Subject: Re: Considering case...
  • From: Bill Cheeseman <email@hidden>
  • Date: Sat, 22 Feb 2014 15:13:10 -0500


On Feb 22, 2014, at 2:46 PM, David Crowe <email@hidden> wrote:

I think the problem is that I'm relying on AppleScript to convert the letter for the arithmetic comparison. The following code works properly:


set c to "E"
considering case
set cnum to (ASCII number c)
if (ASCII number "a") ≤ cnum and cnum ≤ (ASCII number "z") then
display dialog "Character '" & c & "' is lower case."
else if (ASCII number "A") ≤ cnum and cnum ≤ (ASCII number "Z") then
display dialog "Character '" & c & "' is upper case."
end if
end considering

More cumbersome, but more explicit.

No, the AppleScript Language Guide (2013) at page 242 expressly states that the 'less than' and related operators work with text as well as date and numeric values. It's always been that way.

Also, the Guide at pages 138-139 says that 'ASCII number' and 'ASCII character" are deprecated in AppleScript 2.0, because AppleScript text is now based on Unicode. (Although they do work....) As noted in my previous message, the AppleScript 2.0 way to get these values is to use the 'id' property.

-- 

Bill Cheeseman - email@hidden

 _______________________________________________
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

References: 
 >Re: Considering case... (From: Steve Thompson <email@hidden>)

  • Prev by Date: Re: Considering case...
  • Next by Date: Re: Considering case...
  • Previous by thread: Re: Considering case...
  • Next by thread: Re: Considering case...
  • Index(es):
    • Date
    • Thread