Heads & Tails

Jim Hurley jhurley at infostations.com
Sun Dec 11 11:33:10 EST 2005


>Mark Greenburg wrote:
>
>
>
>Beautiful solution!  The arrays are probably much faster than the 
>regular expressions too.  And I learned a new command: Combine.  
>Thanks for teaching me.  : )
>
>On Dec 10, 2005, at 6:52 AM, Jim Hurley wrote:
>
>>  on mouseUP
>>     put field 1 into tText
>>     put char 1 of tText into tLastChar
>>    --Separate the string of h's and t's into words
>>     repeat for each char c in tText
>>       if c = tLastChar then
>>         put c after results
>>       else put  space & c after results
>>         put c into tLastChar
>>     end repeat
>>
>>     --Do a word count
>>     repeat for each word tWord in results
>>       add 1 to tWordCount[tWord]
>>     end repeat
>>
>>     --Display
>>     combine tWordCount with return and comma
>>     put tWordCount into field 2
>  end mouseUP

Mark,

Thanks for the kind words. I learned this trick of doing a word count 
(actually a word use count) from Scott Rainey. I think it was he that 
posted that use of arrays many years ago.

Jim






More information about the use-livecode mailing list