From Pillars of Eternity Wiki
Jump to: navigation, search
Template-info.png Template documentation

This template tests whether a value is a number.


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


Code Result
{{isnumber|1}} 1
{{isnumber| }}
{{isnumber|1}} 1
{{isnumber|1000}} 1000
{{isnumber|10.00}} 10.00
{{isnumber|99 balloons}}
{{isnumber|99.9999e10}} 99.9999e10


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:

Code Result
{{isnumber|{{formatnum:1,000.50|R}}}} 1000.50