Matchtext to find a series of words
Dick Kriesel
dick.kriesel at mail.com
Wed Nov 29 20:28:44 EST 2006
On 11/29/06 4:31 PM, "Brian Yennie" <briany at qldlearning.com> wrote:
> I do think that algorithmically
> one-pass is definitely possible. You just need to pass through the
> text once, and "cross off" each word as you find it. If everything is
> crossed off when you're done, then you're done =).
Good idea, Brian.
-- Dick
on mouseUp
put "The purple dinosaur inadvertently stepped on the cat." & cr \
& "The white dog howled." into tText
put "dog dinosaur cat" into tWords
put textContainsAllWords(tText,tWords)
end mouseUp
function textContainsAllWords tText,tWords
replace "." with space in tText
replace "," with space in tText
split tText using space and space
split tWords using space and space
repeat for each key tWord in tText
delete variable tWords[tWord]
end repeat
return the keys of tWords is empty
end textContainsAllWords
More information about the use-livecode
mailing list