ListContains() Function
I have a table with a column for listing colors.
The current comma delimited color list is: Orange & White, White
When adding a new color, I verify the color being added does not already exists. So I do a simple ListContains() function like this:
<CFSET v.vendorcolors = "Orange & White, White">
<CFSET imprintcolor = "Orange">
<CFIF ListContains(v.vendorcolors,imprintcolor,",")>
<CFSET message = "This color already exists.">
<CFELSE>
<CFSET form.vendorcolors = "#ListAppend(v.vendorcolors,imprintcolor)#">
</CFIF>
As you can see, if it doesn't exist in the list, then I APPEND it to the list.
Now, this was working great until I tried to add "ORANGE" as color.
You can see I have a "Orange & White" color options, but not just "Orange".
When I run this IF statement above, it says the list already contains the color "Orange". If I am telling it to use a comma as the delimiter, then why is it saying it exists?
Chuck
