Here is a function that I've written quite some time ago. It takes a list of
text theList, separated by theitemDel, remove duplicate items in the list,
and returns a new list without duplicate items.
Unfortunately, this function running rather slowly on a large list (a few
thousands records) - that is why I am posting here as a little "open
source", Request For Comment: Make it faster guys!
Remember, the sequence of the records cannot be changed, that say you are
not likely to use sort.

Regards,
LiangTyan Fui

#####

function stripDup theList,theitemDel
  # verify param
  if theList= "" then return ""
  if theitemDel = "" then put cr into theitemDel
  
  #
  set theitemDel to char 1 of theitemDel

  put number of items of theList into theListItem
  put 1 into k
  repeat
    put item k of theList into key1
    repeat with c = theListItem down to k+1
      if key1 = item c of theList then
        delete item c of theList
        subtract 1 from theListItem
      end if
    end repeat
    if k >= theListItem then exit repeat
    add 1 to k
  end repeat
  return theList
end stripDup


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.

Reply via email to