Maybe something like:
function stripDup theList,theitemDel
# verify param
if theList= "" then return ""
if theitemDel = "" then put cr into theitemDel
#
set the itemDelimiter to char 1 of theitemDel
put empty into tResultList
repeat for each item tItem in theList
if tItemList[tItem] is empty then
-- this is much faster than:
-- if tItem is not among the items of tResultList then
-- associative arrays rock
put 1 into tItemList[tItem]
put tItem & theitemDel after tResultList
end if
end repeat
return (char 1 to -2 of tResultList) --remove final delimiter
end stripDup
In my testing, this finds the unique words, in order, in an 8000 word text file in
about .05 seconds. Again, associative arrays rock. The repeat for each... structure
does too.
gc
Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.