longest word in a text

Mark Schonewille m.schonewille at economy-x-talk.com
Fri Jul 14 15:01:40 EDT 2006


Hi JB,

function longestWord theData
   replace space with return in theData
   sort lines of theData numeric by length(each)
   return last line of theData
end longestWord

Best,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Download ErrorLib at http://economy-x-talk.com/developers.html and  
get full control of error handling in Revolution.



Op 14-jul-2006, om 20:46 heeft jbv het volgende geschreven:

> Hi list,
>
> Does anyone have some very fast code to find the longest word
> (number of chars) in a text ?
>
> Here's what I have :
>
>     replace " " with cr in myText
>     put "" into temp
>     set itemdelimiter to tab
>     repeat for each line j in myText
>         put j & tab & number of chars of j & cr after temp
>     end repeat
>     sort temp descending numeric by item 2 of each
>     put item 1 of temp into longest_word
>
> Is there anything faster ?
>
>
> Best,
> JB
>
>




More information about the use-livecode mailing list