This is not the function you are looking for

Yesterday I was doing some editing on the CFML Reference wiki when I ran across a function that is - as far as I know - one of the most misused functions in ColdFusion. What function is that? listContains.

To be clear, listContains is not buggy. It works 100% as advertised. But in the 15 or so years I've used ColdFusion I have not seen one person use it the right way. Simply put, listContains searches a list for partial matches. So for example, given a list of: ray,scott,dave,adam,data. You want to see if the list of names includes ada. If you use listContains then you will get a false positive match on adam. Maybe you do want that. It can happen. But again, I've never seen someone using listContains that really wanted this.

So folks, please keep this in mind. What we really need is a good ColdFusion Linter to flag stuff like this.

p.s. Thank you to Brad Wood for the image!

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments