----- Original Message -----
From: lsellers <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 27, 2000 10:21 AM
Subject: RE: NULL using it in CF



> <CFIF NOT Len(Trim(Form.firstname))> doesn't work
>
> whereas <CFIF Len(Trim(Form.firstname)) GT 0> does work.
>
> Why?
>
> best,  paul

Try
<CFIF Trim(Form.firstname) IS NOT "">
"" is a sort of short-hand for string NULLs. It means "empty string".

True
<CFIF Len(Trim(Form.firstname)) GT 0>
will work, however it should be slower than the other. Why? The first
theoretically only has to test the first character (is it NULL or not?). The
one with len has to run through and count all the characters in the string.

I've never actually timed it in CF, mind you. But I've built string
functions in assembly before, and unless the Allaire programmer really
messed up their code, the first will always be faster, though a bit more
cryptic :)


--min

!-------------------
Lets try this.

<CFIF NOT Compare(Trim(Form.firstname), "")>

And really trim is needed since this is a form field.

that should work as well. this will also most likely provide the
quickest results. I have noticed many people using the
<CFIF string is ""> method. this is the slowest available
method in ColdFusion. this has been proven its easy for you
to see yourself as well. Anyhow check this link out

http://www.fusionauthority.com/alert/index.cfm?alertid=4#Tech2

It discusses string comparison in ColdFusion in much greater detail.
I just really felt compelled to post to the list ive seen way to many
posts saying to do stuff that way and its not really the wrong way
but its not the best way.




----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to