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