Coldfusion: listContains and listFind
What's the Difference Between listContains() and listFind() / listFindNoCase()? They Are All List Functions, Take the Same Parameters, and Return the Same...
Whats the difference between listContains() and listFind() / listFindNoCase()?
They are all list functions, take the same parameters, and return the same result.
1 Answer
listContains looks for the value anywhere in a string, so for example
<cfset list = '1,2,33,4,5' />
<cfdump var="#listContains(list,3)#">
Would return 3 because a 3 is found in the 3rd list item.
listFind looks for the value AS one of the list items.
<cfdump var="#listFind(list,3)#">
Returns 0 because 3 is not one of the list items.