Parameter
This function takes a value and returns "true" or "false" depending on the value.
True, for a non-zero value; False for zero, false, and an empty string ("" ).
BooleanFormat(25) returns true. BooleanFormat(false) returns false.
The function throws an exception when you pass any string other than empty string ("" ).
For example, BooleanFormat("Hello") throws an exception.
But, BooleanFormat("true") or BooleanFormat("yes") returns true.
Similarly, BooleanFormat("false") or BooleanFormat("no") returns false.
Null value
History
New in Adobe ColdFusion (2016 release)
BooleanFormat(value)
Parameter |
Description |
value |
A number, boolean value, null, or an empty string. |
<cfscript> val=0; str="1123"; writeoutput(BooleanFormat(val)); // returns false writeoutput(BooleanFormat(str)); // returns true </cfscript>
<cfscript> val=false; WriteOutput(val.BooleanFormat()); </cfscript>
Sign in to your account