• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.154
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Ifnumber

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
Template documentation[view] [edit] [history] [purge]

Contents

  • 1 Usage
  • 2 Examples
  • 3 Notes
  • 4 See also

Usage

Returns 1 if the value is numeric and 0 otherwise.

Examples

coderesult
{{Ifnumber|1}}

1

{{Ifnumber|one}}

0

{{Ifnumber|}}

0

{{Ifnumber|1|a number|not a number}}

a number

{{Ifnumber|one|a number|not a number}}

not a number

{{Ifnumber|1000|a number|not a number}}

a number

{{Ifnumber|10.00|a number|not a number}}

a number

{{Ifnumber|1,000|a number|not a number}}

not a number

{{Ifnumber|1,000.50|a number|not a number}}

not a number

{{Ifnumber|99 balloons|a number|not a number}}

not a number

{{Ifnumber|99.9999e10|a number|not a number}}

a number

{{Ifnumber|−123|a number|not a number}}

a number

{{Ifnumber|(456)|a number|not a number}}

a number

{{Ifnumber|{{val|123|5}}|number|value "{{val|123|5}}" not numeric}}  value "123±5" 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

  • {{isnumeric}}
The above documentation is transcluded from Template:Ifnumber/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Ifnumber&oldid=19188"
Categories:
  • If-then-else templates
  • Mathematical function templates
  • Wikipedia formatting and function templates
Last edited on 7 March 2022, at 22:36

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 7 March 2022, at 22:36.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop