Toggle menu
1.3K
1.7K
694
23.9K
Veloren Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Bool: Difference between revisions

Template page
Content added Content deleted
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
-->{{#if:{{{1}}}<!--
-->{{#if: {{{1}}}
-->| {{#switch: {{lc: {{trim| {{{1}}} }} }}
| {{#switch: {{lc: {{{1}}} }}
| 1 = 1
| 1 = 1
| yes = 1
| yes = 1
| y = 1
| true = 1
| true = 1
| t = 1
| 0 = 0
| 0 = 0
| no = 0
| no = 0
| n = 0
| false = 0
| false = 0
| f = 0
| undefined
| undefined
}}
}}
Line 15: Line 19:


--><noinclude>
--><noinclude>
Case-insensitive conversion of 'truthy' and 'falsey' input to '1' or '0' (after whitespace trimming).<br>
Case-insensitive conversion of 'truthy' and 'falsey' input to '1' or '0'.<br>
No input -> 'none'<br>
No input -> 'none'<br>
All other input -> 'undefined'
All other input -> 'undefined'

Intended for use in `#ifexpr` templates.<br>
e.g. <nowiki>{{#ifexpr: {{Bool | {{{input}}} }} | true | false }}</nowiki>



input-output table:<br>
input-output table:<br>
Line 27: Line 27:
! input !! output
! input !! output
|-
|-
| <nowiki>{{Bool|}}</nowiki> || {{User:Horblegorble/Sandbox/Template/Bool|}}
| <nowiki>{{Bool|}}</nowiki> || {{Bool|}}
|-
| <nowiki>{{Bool|1}}</nowiki> || {{Bool|1}}
|-
| <nowiki>{{Bool|0}}</nowiki> || {{Bool|0}}
|-
|||
|-
| <nowiki>{{Bool|yes}}</nowiki> || {{Bool|yes}}
|-
| <nowiki>{{Bool|no}}</nowiki> || {{Bool|no}}
|-
|-
| <nowiki>{{Bool|1}}</nowiki> || {{User:Horblegorble/Sandbox/Template/Bool|1}}
| <nowiki>{{Bool|true}}</nowiki> || {{Bool|true}}
|-
|-
| <nowiki>{{Bool|0}}</nowiki> || {{User:Horblegorble/Sandbox/Template/Bool|0}}
| <nowiki>{{Bool|false}}</nowiki> || {{Bool|false}}
|-
|-
|||
|||
|-
|-
| <nowiki>{{Bool|yes}}</nowiki> || {{User:Horblegorble/Sandbox/Template/Bool|yes}}
| <nowiki>{{Bool|y}}</nowiki> || {{Bool|yes}}
|-
|-
| <nowiki>{{Bool|no}}</nowiki> || {{User:Horblegorble/Sandbox/Template/Bool|no}}
| <nowiki>{{Bool|n}}</nowiki> || {{Bool|no}}
|-
|-
| <nowiki>{{Bool|true}}</nowiki> || {{User:Horblegorble/Sandbox/Template/Bool|true}}
| <nowiki>{{Bool|t}}</nowiki> || {{Bool|true}}
|-
|-
| <nowiki>{{Bool|false}}</nowiki> || {{User:Horblegorble/Sandbox/Template/Bool|false}}
| <nowiki>{{Bool|f}}</nowiki> || {{Bool|false}}
|-
|-
|||
|||

Latest revision as of 00:13, 13 September 2023

Case-insensitive conversion of 'truthy' and 'falsey' input to '1' or '0'.
No input -> 'none'
All other input -> 'undefined'

input-output table:

input output
{{Bool|}} none
{{Bool|1}} 1
{{Bool|0}} 0
{{Bool|yes}} 1
{{Bool|no}} 0
{{Bool|true}} 1
{{Bool|false}} 0
{{Bool|y}} 1
{{Bool|n}} 0
{{Bool|t}} 1
{{Bool|f}} 0
{{Bool|Yes}} 1
{{Bool|YES}} 1
{{Bool|No}} 0
{{Bool|NO}} 0
{{Bool|True}} 1
{{Bool|TRUE}} 1
{{Bool|False}} 0
{{Bool|FALSE}} 0
{{Bool| yes}} 1
{{Bool|yes }} 1
{{Bool| yes }} 1
{{Bool|other}} UNDEFINED
Cookies help us deliver our services. By using our services, you agree to our use of cookies.