Something of interest one of our developers found :
---------------------------------------------------------------------------------------
How do you think the following statement will be resolved:
<cfset var1 = "Yes">
<cfif var1 EQ 1>
true
<cfelse>
false
</cfif>
You would think that it would return false (I certainly did), instead it
returns true!
Cold Fusion does a (not so) clever boolean conversion on the string "Yes"
Even if you attempt to cast the 1 as a string "1" in the if:
<cfif var1 EQ "1">
true
<cfelse>
false
</cfif>
Still true!
The only way to get around this is to do an extra check of IsNumeric():
<cfif IsNumeric(var1) AND var1 EQ 1>
true
<cfelse>
false
</cfif>
Then you get false (hurray!).
------------------------------------------------------------------------------------------------------
Matt Horn
Senior Web Applications Developer
MediaTel Group
84-86 Regent Street
London
W1B 5AJ
Tel: +44(0)20 7439 7575
Fax: +44(0)20 7734 0940
www.MediaTelGroup.co.uk
MediaTel Group - Maximising efficiency across the entire media process.
Are you the best sporting brain in the industry?
Visit www.MediaTelGroup.co.uk/sportsquiz to enter our Sports Quiz in aid of
Whizz-Kidz
This message is for the named recipient's use only and may contain
confidential or privileged information. If you receive this message in
error, please immediately delete it and all copies of it from your system,
destroy any hard copies of it and notify the sender. You must not, directly
or indirectly, use, disclose, distribute, print, or copy any part of this
message if you are not the intended recipient. Email communications are not
secure and therefore the MediaTel Group does not accept liability for any
errors or omissions in the contents of this message which arise as a result
of email transmission. MediaTel reserves the right to monitor all email
communications through its networks. Any views expressed by an individual
in this email do not necessarily reflect the views of the MediaTel Group.
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]
- Re: [ cf-dev ] CF "Feature" Matt Horn
- Re: [ cf-dev ] CF "Feature" Stephen Moretti
- Re: [ cf-dev ] CF "Feature" Matt Horn
- Re: [ cf-dev ] CF "Feature" Stephen Moretti
- RE: [ cf-dev ] CF "Feature" Douglas Humphris
- RE: [ cf-dev ] CF "Feature" Rich Wild
- RE: [ cf-dev ] CF "Feature" Spike
- RE: [ cf-dev ] CF "Feature" Kola Oyedeji
- RE: [ cf-dev ] CF "Feature" Spike
- RE: [ cf-dev ] CF "Feature&quo... Matt Horn
- RE: [ cf-dev ] CF "Feature... Steve D
