Quick Challenge
Roger Eller
roger.e.eller at sealedair.com
Thu Aug 27 11:09:07 EDT 2015
A silly variation...
on mouseUp
set the caseSensitive to true
put "Mary had a little LAMB. Its fleece was WHITE as cocaine. Everywhere
that Mary went, she would shout, WINNING!" into tWords
replace "." with empty in tWords
replace "," with empty in tWords
replace "!" with empty in tWords
repeat for each word thisWord in tWords
if thisWord is toUpper(thisWord) then put thisWord & cr after
tCapWords
end repeat
set the caseSensitive to false
answer tCapWords
end mouseUp
On Thu, Aug 27, 2015 at 10:39 AM, David Bovill <david at viral.academy> wrote:
> So what's the quickest way to tell is a word is all caps in Livecode? I
> guess there are a lot of ways to skin a cat with this one. This is what I'm
> tinkering with:
>
> function text_IsCaps someText
> > put "\b[A-Z]+\b" into someReg
> > return matchtext (word 1 to -1 of someText, someReg, anyThing)
> >
> > repeat for each char testChar in someText
> > put chartonum (testChar) into someCharNum
> > if someCharNum >= 65 and someCharNum <= 90 then
> > return false
> > end if
> > end repeat
> > return true
> > end text_IsCaps
>
>
More information about the use-livecode
mailing list