Utility Function: ListIsEmpty()

While this is a simple bit of code to write, I personally like the syntax of checking "something is empty" over writing len(something) gt 0.

<cffunction name="ListIsEmpty" access="public" output="false" returntype="boolean">
    <cfargument name="list" type="string" required="true" />
    <cfargument name="delimiters" type="string" required="false" default="," />
    
    <cfreturn (ListLen(arguments.list, arguments.delimiters) gt 0) />
</cffunction>

 

Comments

Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me.

Post a job. Find one. authenticjobs.com

Interested in becoming a sponsor? Contact me.