Matchtext for multiple words

Mark Smith mark at maseurope.net
Thu Nov 30 10:52:53 EST 2006


Another go. Assumes the wordList to be a comma separated list.

function wordMatch wordList, pText
   put "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" & space  
& tab & cr into tGoodChars
   repeat for each char c in pText
     if c is in tGoodChars then put c after tText
   end repeat

   repeat for each item i in wordList
     if i is not among the words of tText then return false
   end repeat
   return true
end wordMatch

It seems a bit brutish, but it's reasonably quick, and it won't find  
"tent" in "content" and will find "yikes" in "(yikes!)".

Best,

Mark




More information about the Use-livecode mailing list