See also
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
- BooleanFormat("null"): Throws an exception because null is treated as a string.
- BooleanFormat(null): Null is treated as a variable, so will search for the value. If no such variable exists, an exception is thrown.
- BooleanFormat(javacast("null","null")): Here actual null is being passed, and hence it will return false.
String BooleanFormat(value)
<cfscript> val=0; str="1123"; writeoutput(BooleanFormat(val)); // returns false writeoutput(BooleanFormat(str)); // returns true </cfscript>