Spec-Zone.ru › ColdFusion

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

  • Lucee
  • BL 1.0.0+
  • See Also: yesNoFormat isBoolean booleanFormat

    Argument Reference

    value boolean
    Required

    Examples
    Sample code invoking the trueFalseFormat function

    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

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/truefalseformat

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API