CamelCase

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Aug 29 07:59:04 EDT 2005


Hi David,

I use the following function.
It does not differentiate lower camelCase from upper ones (CamelCase).
As I use it to parse scripts, the text to parse is not too long and  
it's enough for my "internal" needs.
But I imagine there are faster solutions :-)
It's certainly not the quickest...

function ExtractCamelCase pText
   local tToken,tCamelCaseList
   -----
   repeat for each token tToken in pText
     if the number of words of tToken > 1 then next repeat
     if charToNum(char 1 of tToken) < 65 or charToNum(char 1 of  
tToken) > 122 then next repeat
     repeat with i = 2 to the (number of chars of tToken - 1)
       if charToNum(char i of tToken) > 64 and charToNum(char i of  
tToken) < 91 and tToken is not among the lines of tCamelCaseList then
         put tToken & cr after tCamelCaseList
         next repeat
       end if
     end repeat
   end repeat
   delete last char of tCamelCaseList
   sort tCamelCaseList
   return tCamelCaseList
end ExtractCamelCase

Le 29 août 05 à 13:09, david bovill a écrit :

> What's the quickest way to find all the CamelCase words in some  
> text - anyone have a regular expression or script for this?

Best Regards from Paris,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list