> If i have a list like:
>  
> 2,10,3,1,2,9,9,2
>  
> what is the easiest way to parse out the dupes to make the list:
> 2,10,3,1,9
>  

May not be the easiest, but ...

<cfset originalList="2,10,3,1,2,9,9,2">
<cfset tmpList="">
<cfloop index="item" list=originalList>
 <cfif(NOT ListFindNocase(tmpList,item)>
  <cfset tmp=ListAppend(tmpList,item)>
 </cfif>
</cfloop>
 
OR,

You could use ListValueCountNoCase(), but you'll
end up spending more processing time as you'll have
to reloop every time you find a return > 1 and do a 
ListDeleteAt() for the 2nd+ occurrences.

Or,

You could build a structure and use StructKeyExists(),
..... etc.  

In short there area lot of way to code what you
want to do ... "easiest" is up to you, but the first method
I outlined should be reasonably quick and simple - it does
operate in linear time so there might be a faster method.

Pan




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to