"Recognition" of upper or lower case in a field

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

"Recognition" of upper or lower case in a field

Post by gyroscope » Wed Oct 14, 2009 1:26 pm

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?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Wed Oct 14, 2009 1:50 pm

rev is by default not case sensitive, therefore a=A.

check out the caseSensitive property.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Wed Oct 14, 2009 2:47 pm

rev is by default not case sensitive, therefore a=A.
Useful to know, thanks BvG. I'l check out caseSensitive now.

:)

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith » Thu Oct 15, 2009 10:52 pm

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

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Sat Oct 17, 2009 10:23 pm

That's neat Mark, thanks.

:)

Post Reply