Page 1 of 1

"Recognition" of upper or lower case in a field

Posted: Wed Oct 14, 2009 1:26 pm
by gyroscope
Hi, a small test again:

Result required is whether or not a character is upper case or lower case.
A field for input, a button and field for output.

Code: Select all

on mouseUp
   put field "FI" into tW
   
   if tW="A" or tW="B" or tW="C" then ----etc
      put "U" into fld "FO"
   else
      if tW="a" or tW="b" or tW="c" then ------etc
         put "L" into field "FO"
      end if
      end if
end mouseUp
Whether it's upper or lower case, the result is always "U". I know that all characters have their own ASCII number, which surely must be inherent in the typed character, so surely this should work? I'll script using CharToNum I guess, it's bound to work then.

But I'm just curious to know why this doesn't work. Does anyone know please?

Posted: Wed Oct 14, 2009 1:50 pm
by BvG
rev is by default not case sensitive, therefore a=A.

check out the caseSensitive property.

Posted: Wed Oct 14, 2009 2:47 pm
by gyroscope
rev is by default not case sensitive, therefore a=A.
Useful to know, thanks BvG. I'l check out caseSensitive now.

:)

Posted: Thu Oct 15, 2009 10:52 pm
by Mark Smith
To test for uppercase ASCII chars:

Code: Select all

function isUpper pChar
  get charToNum(pChar)
  return it >= 65 and it <= 90
end isUpper
Best,

Mark Smith

Posted: Sat Oct 17, 2009 10:23 pm
by gyroscope
That's neat Mark, thanks.

:)