Template:Boolean

From Pittsburgh Streets
The {{boolean}} template parses an input string as a boolean value. If the input is 1, on, t, true, y, or yes (case-insensitive), then the template produces 1; otherwise the template produces the empty string.

Usage examples and test cases

  • {{boolean|0}}
  • {{boolean|1}} → 1
  • {{boolean|false}}
  • {{boolean|true}} → 1
  • {{boolean|FALSE}}
  • {{boolean|TRUE}} → 1
  • {{boolean|f}}
  • {{boolean|t}} → 1
  • {{boolean|no}}
  • {{boolean|yes}} → 1
  • {{boolean|n}}
  • {{boolean|y}} → 1
  • {{boolean|N}}
  • {{boolean|Y}} → 1
  • {{boolean|off}}
  • {{boolean|on}} → 1
  • {{boolean}}

In an #if

  • {{#if:{{boolean|true}}|That's the truth!|That's a lie!}} → That's the truth!
  • {{#if:{{boolean|false}}|That's the truth!|That's a lie!}} → That's a lie!

See also