On Tuesday, Nov 5, 2002, at 10:57 US/Pacific, Randell B Adkins wrote: > <cfset newList = ''> > <cfoutput> > <CFLOOP INDEX=i LIST="#mList#"> > <CFIF LISTCONTAINS(newList,TRIM(i)) EQ FALSE> > <CFSET newList = ListAppend(newList,i)> > </CFIF> > </CFLOOP> > </cfoutput>
Beware of how many comparisons (and list operations in general!) this does! Assume n unique items and it works like this: n compares 1 1 (against an empty list) 2 2 (1 against an empty list, 1 against a list with 1 elem) 3 4 4 7 5 11 6 16 7 22 8 29 9 37 10 46 "I can smell your brains!" -- Mittens the Kitten : http://www.matazone.co.uk/theotherside.html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.