Template:Ifnum

This function evaluates a given string and determines whether it is a valid number or mathematical expression.


 * {&#123;ifnum| string | value if valid | value if invalid }}

The function will accept strings that are valid expressions.


 * {&#123;ifnum|7|valid|invalid}} → 
 * {&#123;ifnum|meow|valid|invalid}} → 
 * {&#123;ifnum|7+7|valid|invalid}} → 
 * {&#123;ifnum|e|valid|invalid}} → 
 * {&#123;ifnum|trunc(7.7)|valid|invalid}} → 

Empty value parameters default to the string if valid, and nothing if invalid.
 * {&#123;ifnum|7}} → 
 * {&#123;ifnum|meow}} → 

Entering no string outputs value if valid.
 * {&#123;ifnum||valid|invalid}} → 

The template can be substituted for an imprinted result.
 * {&#123;subst:ifnum|7|valid|invalid}} → valid
 * {&#123;subst:ifnum|meow|valid|invalid}} → invalid