Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

determining empty string 1

Status
Not open for further replies.

imstillatwork

IS-IT--Management
Sep 26, 2001
1,605
US
what way is "better" (more standard, faster, more reliable, etc..)

<cfif NOT varString EQ &quot;&quot;>

OR

<cfif len(varString)>

??

Thanks just curious

 
For string comparisons MM are recomending this:

<CFIF CompareNoCase(varString, &quot;&quot;) EQ 0>
empty string
<CFELSE>
something in the string
</CFIF>

A lot more code on the page than a Len(varString) GT 0 but apparently its faster.

if you want to do multiple compares they suggest this:

<CFSET a = CompareNoCase(varString,&quot;&quot;)>

<CFSWITCH EXPRESSION=&quot;#variables.a#&quot;>
<CFCASE VALUE=&quot;1&quot;>
do something
</CFCASE>
<CFCASE VALUE=&quot;0&quot;>
do something else
</CFCASE>

<CFCASE VALUE=&quot;-1&quot;>
do something complatly diffeent
</CFCASE>
</CFSWITCH>

hope this helps!

Tony
 
Sorry, Carl is right really should read the whole article instead of just skim reading.

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top