Coldfusion: listContains and listFind

Whats the difference between listContains() and listFind() / listFindNoCase()?

They are all list functions, take the same parameters, and return the same result.

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest