Count instances of replace with replace command
yves COPPE
yvescoppe at skynet.be
Mon May 5 02:23:05 EDT 2003
>is it possible to count the number instances handled when issuing
>
>replace "old" with "new" in someText
>
>the result returns empty.
>
try this before you replace :
function howmany what -- what is your text
repeat for each word w in what
add 1 to wordCount[w]
end repeat
put keys(wordCount) into keyWords
sort keyWords
repeat for each line l in keyWords
put l & tab & wordCount[l] & return after displayResult
end repeat
delete last char of displayResult
return displayResult
end howmany
so you have a list of all the words with their occurences.
Hope this help
--
Greetings.
Yves COPPE
Email : yvescoppe at skynet.be
More information about the use-livecode
mailing list