Pillars of Eternity Wiki
Advertisement
Pillars of Eternity Wiki
Template-info.png Template documentation

This template tests whether a value is a number.

Usage

Use {{Isnumber|123}}, which will return the input value "123" if it is a number, and blank otherwise.

To do something if the input is indeed a number, encapsulate this template within an "if" ParserFunction, for example:

{{#if:{{isnumber|123}}|is a number|not a number}} -> is a number

Examples

Code Result
{{isnumber|1}} 1
{{isnumber|one}}
{{isnumber| }}
{{isnumber|1}} 1
{{isnumber|one}}
{{isnumber|1000}} 1000
{{isnumber|10.00}} 10.00
{{isnumber|1,000}}
{{isnumber|1,000.50}}
{{isnumber|99 balloons}}
{{isnumber|99.9999e10}} 99.9999e10

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}}.
Code Result
{{isnumber|1,000.50}}
{{isnumber|{{formatnum:1,000.50|R}}}} 1000.50
Advertisement