cfdocs

trueFalseFormat

Returns the string true or false when a boolean value is passed in. Throws an exception if the value passed in cannot be converted to a boolean.

trueFalseFormat(value)
returns string

Argument Reference

Name Type Required Default Description
value boolean Yes    

Numeric 1 is interpreted as true

trueFalseFormat(1)

Expected Result: true

Numeric 0 is interpreted as false

trueFalseFormat(0)

Expected Result: false

String representation of 1 is interpreted as true

trueFalseFormat('1')

Expected Result: true

String representation of 0 is interpreted as false

trueFalseFormat('0')

Expected Result: false

YES is recognized as synonym for true as well

trueFalseFormat('YES')

Expected Result: true

And NO as synonym for false

trueFalseFormat('NO')

Expected Result: false

An empty string results in false again

trueFalseFormat('')

Expected Result: false