List Words from Textarea

Jim Ault jimaultwins at yahoo.com
Thu Oct 14 00:17:58 EDT 2010


Caution with this solution.
The definition of a 'word' for LiveCode is not what you would normally  
think.

Spaces are not the only white space, and punctuation that is attached  
to the word is included as part of a word.

On Oct 13, 2010, at 4:30 PM, Jim Lambert wrote:

> Razvan wrote:
>>
>> How can I list every word from a textarea?
>
> First, welcome Razvan!
>
> In addition to Pierre"s and Richmond's suggestions, here's a few:
>
> function getWordList someText
> 	replace space with cr in someText
> 	return someText
> end getWordList
>
> function getUniqueWordList someText
> 	repeat for each word w in someText
> 	if w is not among the lines of uniqueWord then put w & cr after  
> uniqueWords	
> 	end repeat
> 	-- AND JUST FOR THE HECK OF IT
> 	sort uniqueWords
> 	return uniqueWords
> end getWordList
>
> Jim Lambert

Jim Ault
Las Vegas






More information about the use-livecode mailing list