• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Ifnumber

  • Template
  • Talk
  • Language
  • Watch
  • View source
(Redirected from Template:If number)
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 66,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.

Contents

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

Usage

Returns 1 if the value is numeric and 0 otherwise.

Examples

code result
{{Ifnumber|1}}

1

{{Ifnumber|one}}

0

{{Ifnumber|}}

0

{{Ifnumber|e<>pi}}

1

{{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|e|a number|not a number}}

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

code result
{{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://en.wikipedia.org/w/index.php?title=Template:Ifnumber&oldid=1304298969"
Last edited on 5 August 2025, at 05:23

Languages

    • Аԥсшәа
    • العربية
    • অসমীয়া
    • Asturianu
    • Авар
    • Azərbaycanca
    • تۆرکجه
    • Basa Bali
    • বাংলা
    • 閩南語 / Bân-lâm-gí
    • Беларуская (тарашкевіца)
    • भोजपुरी
    • Bosanski
    • Буряад
    • Català
    • Cebuano
    • Cymraeg
    • Dansk
    • Eesti
    • فارسی
    • Føroyskt
    • Français
    • Gaeilge
    • Galego
    • 客家語 / Hak-kâ-ngî
    • 한국어
    • Hausa
    • हिन्दी
    • Hrvatski
    • Ilokano
    • Bahasa Indonesia
    • Íslenska
    • עברית
    • Jawa
    • ಕನ್ನಡ
    • ქართული
    • Latina
    • मैथिली
    • Македонски
    • മലയാളം
    • مصرى
    • Bahasa Melayu
    • Minangkabau
    • 閩東語 / Mìng-dĕ̤ng-ngṳ̄
    • Mirandés
    • မြန်မာဘာသာ
    • Nederlands
    • नेपाली
    • 日本語
    • Нохчийн
    • Norsk bokmål
    • Occitan
    • ଓଡ଼ିଆ
    • Oʻzbekcha / ўзбекча
    • Polski
    • Português
    • Qaraqalpaqsha
    • Română
    • Русский
    • Sakizaya
    • سرائیکی
    • Scots
    • සිංහල
    • Simple English
    • سنڌي
    • Slovenščina
    • کوردی
    • Српски / srpski
    • Suomi
    • Svenska
    • Tagalog
    • தமிழ்
    • တႆး
    • తెలుగు
    • ไทย
    • Тоҷикӣ
    • Türkçe
    • Українська
    • اردو
    • Tiếng Việt
    • 吴语
    • 粵語
    • 中文
    • Kadazandusun
    • Jaku Iban
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 5 August 2025, at 05:23 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop