on countOccurances tWordToFind, tText
-- tWordToFind = "is"
-- tText = "is this is a big longish string of issues and isms or isn't it?"
iCount = 0
iPos = 1
iMax = tText.char.count
iOffset = tWordToFind.char.count
repeat while true
iSubPos = offset(tWordToFind, tText.char[iPos..iMax])
if iSubPos then
iCount = iCount + 1
iPos = iPos + iSubPos + iOffset
else
exit repeat
end if
end repeat
return iCount
end
At 03:15 PM 1/9/2005, you wrote:
Hi,
I need to count how many times specific words or parts of words exist in a text. Is there a fast way to do this? Since I also need to find words inside other words (for example the word "lotion" should also be found in "sulotions" etc) I can't just repeat through the words and compare them.
Any ideas?
Thanks in advance,
/Karl Cifius
_________________________________________________________________ L�ttare att hitta dr�mresan med MSN Resor http://www.msn.se/resor/
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
----------- Roy Crisman Macromedia Director Programmer, Lingo Guru, Multimedia Producer 277 N. Goodman St. Rochester, NY 14607-1162 (585)473-3492 home (585)615-2873 cell roymeo(AT)brokenoffcarantenna.com
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
