• 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: "koenig.yvan" <email@hidden>
  • Date: Sat, 22 Feb 2014 20:54:45 +0100


Le 22/02/2014 à 20:46, David Crowe <email@hidden> a écrit :

Steve;


Thanks for showing that alternative.

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.

- David Crowe


On Feb 22, 2014, at 12:21 PM, Steve Thompson <email@hidden> wrote:

Erm, don’t know. This does work

set c to "E" as text
considering case
if c is not in "abcdefghijklmnopqrstuvwxyz" then
display dialog "Character '" & c & "' is upper case."
end if
end considering

so I’m assuming it has something to do with the way AppleScript evaluates the inequalities when they involve text. Could possibly be a bug unless someone else knows different.

Steve

On 22 Feb 2014, at 18:15, David Crowe <email@hidden> wrote:

Why does this not work? It prints out that "E" is lower case. 


set c to "E"
considering case
if "a" ≤ c and c ≤ "z" then
display dialog "Character '" & c & "' is lower case."
end if
end considering

I've tried this on Mavericks and 10.6 and get the same thing. Using "Smile" and the standard AppleScript editor gives the same result.

What am I missing?

- David Crowe




And if the character to test is "é" or "È" your handler will respond nothing.

Yvan KOENIG (VALLAURIS, France) samedi 22 février 2014 20:54:37




 _______________________________________________
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: Considering case...
      • From: Christopher Stone <email@hidden>
    • Re: Considering case...
      • From: "koenig.yvan" <email@hidden>
References: 
 >Re: Considering case... (From: Steve Thompson <email@hidden>)

  • Prev by Date: Re: Considering case...
  • Next by Date: Re: Coerce Script to Text?
  • Previous by thread: Re: Considering case...
  • Next by thread: Re: Considering case...
  • Index(es):
    • Date
    • Thread