Template:Ifnumber

From Heroes 3 wiki
Revision as of 17:48, 15 December 2023 by Imahero (talk | contribs)
Jump to navigation Jump to search

Usage

Returns 1 if the value is numeric and 0 otherwise.

Examples

Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row Template:Template example row

coderesult
{{Ifnumber|{{val|123|5}}|number|value "{{val|123|5}}" not numeric}}  value "Template:Val" not numeric

Notes

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}}.

coderesult
{{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