Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

duplicate value

Status
Not open for further replies.

newbby

Programmer
Mar 16, 2004
36
US
All,
I have a variable that holds a comma delimited list of upto 5 numbers.How can I check that the numbers are not duplicated.
eg: the below is a good set
<cfset varMyNumbers = "12,43,55,76,44">
the below is not a good set
<cfset varMyNumbers = "12,43,55,76,43"> (43 is duplicated)
Thanks
 
<CFSET ListHasDupes="no">
<CFLOOP INDEX="i" FROM="1"
TO="#ListLen(varMyNumbers)#">
<CFSET item=ListGetAt(varMyNumbers,i)>
<CFIF ListValueCount(varMyNumbers,item) GT 1>
<CFSET ListHasDupes="yes">
<CFBREAK>
</CFIF>
</CFLOOP>

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top