testing on case
Alex Tweedly
alex at tweedly.net
Wed Dec 8 19:04:55 EST 2004
At 17:24 08/12/2004 -0500, 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
Hmmmm - that says that "ABC DEF" is not uppercase (because of the space in
the middle).
function isUpperCase pText
set caseSensitive to true
return (pText = upper(pText))
end isUpperCase
Not that that's perfect either - the problem is there are 4 (or 5) possible
results
upper case
lower case
word case
mixed case
no case (i.e. no letters)
so deciding just which ones to include as "isUpperCase" is a
context-dependent choice.
-- Alex.
More information about the use-livecode
mailing list