Mal:Ifnumber
Tampilan
Mal dokumentasi[cingak] [obah] [lelintihan] [purge]
Usage
[uah wit]Returns 1 if the value is numeric and 0 otherwise.
Examples
[uah wit]Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row Mal:Template example row
code | result |
---|---|
{{Ifnumber|{{val|123|5}}|number|value "{{val|123|5}}" not numeric}} | value "±5" not numeric 123 |
Notes
[uah wit]This template will not recognize formatted numbers, which is by design since formatted numbers will break expression parsers. To remove the formatting from a number, you can wrap the number first in {{formatnum: number |R}}.
code | result |
---|---|
{{Ifnumber|1,000.50|a number|not a number}} | not a number |
{{Ifnumber|{{formatnum:1,000.50|R}}|a number|not a number}} | a number |
See also
[uah wit]- {{isnumeric}}
The above Dokumentasi is transcluded from Mal:Ifnumber/doc. (obah | lelintihan) Editors can experiment in this template's sandbox (ngae | mirror) and testcases (ngae) pages. Please add categories to the /doc subpage. Subpages of this template. |