longest word in a text

Brian Yennie briany at qldlearning.com
Fri Jul 14 15:12:46 EDT 2006


JB,
I don't know how the speed compares, but you don't necessarily need to 
go to the trouble of sorting if you only care about the longest word:

put 0 into maxLength
repeat for each word w in tText
    get length(w)
    if (it > maxLength) then put it into maxLength
end repeat

I would think that sorting everything would be costly unless you 
actually need to know the length of every word.

- Brian




More information about the use-livecode mailing list