Matchtext to find a series of words

Mark Smith mark at maseurope.net
Wed Nov 29 20:49:02 EST 2006


On 30 Nov 2006, at 00:31, Brian Yennie wrote:

> 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 =).

That's a much better idea than mine, so:

function aMatch pWords,tText
   -- first remove punctuation marks from the word list, perhaps  
unneccessary
   repeat for each char C in pWords
     if C is cr OR charToNum(C) >= 65 then put C after tWords
   end repeat

   repeat for each word W in tText
     put empty into newWord

     repeat for each char C in W
       get charToNum(C)
       if it >= 65 AND it <= 122 then put C after newWord
     end repeat

     if newWord is among the lines of tWords then
       filter tWords without newWord
     end if

     if tWords is empty then return true
   end repeat

   return false
end aMatch



More information about the use-livecode mailing list