CamelCase

Cubist at aol.com Cubist at aol.com
Mon Aug 29 15:28:15 EDT 2005


sez jhurley at infostations.com:
>>From: david bovill <david at openpartnership.net:lCase words in some text
>>- anyone have a regular expression or script for this?
>Depending on the complexity of your text, you might find the 
>following function useful:
>
>function thereIsAnInteriorCapitalLetter tText  --Self referential name
>   delete char 1 of tText
>   delete char -1 of tText
   Stupid question: Why delete char -1? What difference would it make if you 
didn't?

>   set the caseSensitive to true
>   if toLower(tText)= tText then
>     return false
>   else return true
   This IF statement can be replaced by one line: "return (not (toLower 
(tText) = tText))"

>end thereIsAnInteriorCapitalLetter
   This handler may or may not do Bovill's job, depending on what sort of 
strings count as being CamelCase. A few test-cases:
   "getLost" -- true
   "ALPHABET" -- true
   "explicitX" -- false
   I suspect that all-caps strings ought not be considered CamelCase, 
myself...



More information about the use-livecode mailing list