testing on case

Dar Scott dsc at swcp.com
Wed Dec 8 16:46:05 EST 2004


On Dec 8, 2004, at 2:09 PM, Hershel Fisch wrote:

> Thanks, I think its a bit to much when I wanted it to set up query's , 
> too many functions involved. I hoped that there is a
> if param(x) "is upperCase" then put xxx  else put x

I don't understand why a function won't work.

Here is a simpler function that you can apply to just a word:

function isUpperCase w
   constant capitalLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   set the caseSensitive to true
   return char 1 of w is in capitalLetters
end isCapitalized

if isUpperCase( param(x) ) then put xxx else put x


If you must avoid a function (sniff, I like functions), then consider 
this:

if matchText( param(x), "^[A-Z]") then put xxx else put x

Dar


****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************



More information about the use-livecode mailing list