testing on case

Hershel Fisch hershrev at realtorsgroup.us
Thu Dec 9 13:49:07 EST 2004


on the first letter , but good to know-'em both ways.
Thanks,Hershel
On Wednesday, December 8, 2004, at 05:24 PM, Frank D. Engel, Jr. wrote:

> Are you trying to test the first letter only, or the entire string?  
> The proposals so far only test the first character of the string.  If 
> you need the whole thing to be uppercase:
>
> function uppercase ofText
>   set the caseSensitive to true
>   repeat for each char ch in "abcdefghijklmnopqrstuvwxyz"
>     if ch is among the chars of ofText then return false
>   end repeat
>   return true
> end uppercase
>
>
> Now you can do things like:
>
> if uppercase(ofText) then
>   -- whatever
> end if
>
>
> or to test the first char of each word:
>
> function wordcase ofText
>   set the caseSensitive to true
>   repeat for each word w in ofText
>     if char 1 of w is among the chars of "abcdefghijklmnopqrstuvwxyz" 
> then return false
>   end repeat
>   return true
> end wordcase
>
>
> and similarly,
>
> if wordcase(ofText) then
>   -- do something
> end if
>
> On Dec 8, 2004, at 4:55 PM, Dar Scott wrote:
>
>>
>> On Dec 8, 2004, at 2:46 PM, Dar Scott wrote:
>>
>>> 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
>>
>> or this (if useUnicode is not true and you know it starts with a 
>> letter)
>>
>> if charToNum( param(x) ) < 97 then put xxx else put x
>>
>> To me a function is more readable.  Are you concerned about speed?
>>
>> Dar
>>
>> ****************************************
>>     Dar Scott Consulting
>>     http://www.swcp.com/dsc/
>>     Programming Services
>> ****************************************
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
> -----------------------------------------------------------
> Frank D. Engel, Jr.  <fde101 at fjrhome.net>
>
> $ ln -s /usr/share/kjvbible /usr/manual
> $ true | cat /usr/manual | grep "John 3:16"
> John 3:16 For God so loved the world, that he gave his only begotten 
> Son, that whosoever believeth in him should not perish, but have 
> everlasting life.
> $
>
>
>
> ___________________________________________________________
> $0 Web Hosting with up to 120MB web space, 1000 MB Transfer
> 10 Personalized POP and Web E-mail Accounts, and much more.
> Signup at www.doteasy.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list