My Account   Contact Us    
  
» HomeProductsSupportDeveloper CommunityCompany
Zero length String comparison
Use the Len function instead of IS ""

Type: performance
Severity: (3)

Incorrect example
<cfif form.email IS "">
  Hey enter a email address
</cfif>

Resolution

<cfif NOT Len(form.email)>
  Hey enter a email address
</cfif>
Explanation

Use the Len function to check for zero length strings, you will reap a small performance benefit. The use of IS "" is slightly more readable, so there is a tradeoff between performance and readibility.

Sign up for our newsletter: | Subscribe with RSS: RSS
© ActivSoftware 1999 to 2005 | Privacy Statement