FineTune searching
Mark Wieder
mwieder at ahsoftware.net
Wed May 4 20:00:38 EDT 2005
Hugh-
Here's my take on what you presented:
function booleanMatch fineTuneLevel, pStr, pSrcString
local blnReturn
-- turn multiple lines into a stream
replace cr with space in pSrcString
put false into blnReturn
--| Param fineTuneLevel:
-- 1 = exact phrase
-- 2 = all words [AND]
-- 3 = any string [OR]
switch fineTuneLevel
case 1 -- EXACT
filter pSrcString with "*" & pStr & "*"
put (pSrcString is not empty) into blnReturn
break
case 2 -- ALL
repeat for each word w in pStr
filter pSrcString with "*" & w & "*"
end repeat
put (pSrcString is not empty) into blnReturn
break
default -- ANY
repeat for each word w in pStr
if (w is in pSrcString) then
put true into blnReturn
-- no need to go on
exit repeat
end if
end repeat
end switch
return blnReturn
end booleanMatch
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list