(Created page with "{{Template|IsNum}} template tests whether a value is numeric (or at least, that it can be treated as such by the expression ParserFunction). ==Usage== It has one {{Parameter|mandatory|string}} and one {{Parameter|optional|named}}: By default, simply writing {{Code|<nowiki>{{IsNum|1,327}}</nowiki>}} (where 1,327 is an example number) will pass through the parameter if it's numeric and return blank if it's not. If the parameter {{Code|boolean=true}} is given, as in {{Cod...") |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly>[[Category:Helper Template]]</includeonly> | |||
{{Template|IsNum}} template tests whether a value is numeric (or at least, that it can be treated as such by the expression ParserFunction). | {{Template|IsNum}} template tests whether a value is numeric (or at least, that it can be treated as such by the expression ParserFunction). | ||
==Usage== | ==Usage== | ||
It has one {{Parameter|mandatory|string}} and one {{Parameter|optional|named}}: | It has one {{Parameter|mandatory|string}} and one {{Parameter|optional|named}}: | ||
* {{Code|1}} is the parameter to be tested; the template will pass through the parameter if it's numeric and return blank if it's not. | |||
* {{Code|bool}} (default {{code|false}} — if set to {{code|true}}, the template will output {{Code|true}} if numeric and {{Code|false}} if not numeric. | |||
==Return== | ==Return== | ||
{{TableTop|Code|Return}} | {{TableTop|Code|Return}} | ||
{{TableMid|{{Code|<nowiki>{{IsNum|1,327.50}}</nowiki>}}| {{IsNum|1,327.50}}}} | {{TableMid|{{Code|<nowiki>{{IsNum|1,327.50}}</nowiki>}}| {{IsNum|1,327.50}}}} | ||
| Line 15: | Line 15: | ||
{{TableMid|{{Code|<nowiki>{{IsNum|500*500}}</nowiki>}}| {{IsNum|500*500}}}} | {{TableMid|{{Code|<nowiki>{{IsNum|500*500}}</nowiki>}}| {{IsNum|500*500}}}} | ||
{{TableMid|{{Code|<nowiki>{{IsNum|9.999e50}}</nowiki>}}| {{IsNum|9.999e50}}}} | {{TableMid|{{Code|<nowiki>{{IsNum|9.999e50}}</nowiki>}}| {{IsNum|9.999e50}}}} | ||
{{TableMid|{{Code|<nowiki>{{IsNum|1+1| | {{TableMid|{{Code|<nowiki>{{IsNum|1+1|bool=true}}</nowiki>}}| {{IsNum|1+1|bool=true}}}} | ||
{{TableMid|{{Code|<nowiki>{{IsNum|2b∨¬2b|bool=true}}</nowiki>}}| {{IsNum|2b∨¬2b|bool=true}}}} | |||
{{TableEnd}} | {{TableEnd}} | ||
Latest revision as of 16:10, 24 October 2022
Template:IsNum template tests whether a value is numeric (or at least, that it can be treated as such by the expression ParserFunction).
Usage
It has one mandatory string parameter and one optional named parameter:
1is the parameter to be tested; the template will pass through the parameter if it's numeric and return blank if it's not.bool(defaultfalse— if set totrue, the template will outputtrueif numeric andfalseif not numeric.
Return
| Code | Return |
|---|---|
{{IsNum|1,327.50}} | 1,327.50 |
{{IsNum|9,999 (1950)}} | |
{{IsNum|9999999999999}} | 9999999999999 |
{{IsNum|500 metres}} | |
{{IsNum|500*500}} | 500*500 |
{{IsNum|9.999e50}} | 9.999e50 |
{{IsNum|1+1|bool=true}} | true |
{{IsNum|2b∨¬2b|bool=true}} | false |
