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

Template:Cardinal

  • Template
  • Talk
  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:String (sandbox)

This template converts an ordinal number into a cardinal number by stripping the ordinal indicator off the end of the only parameter. Specifically, it removes any series of letters that immediately follows a numeral.

This template should not be used in running prose in articles; it is intended for automated script processing of numeric data. Writing something like "on August {{cardinal|16th}}, 2004" serves no purpose, and just makes the wikicode harder to understand and edit.

Examples

Markup Output
{{cardinal|-1st}}

-1

{{cardinal|0th}}

0

{{cardinal|1st}}

1

{{cardinal|2nd}}

2

{{cardinal|3rd}}

3

{{cardinal|4th}}

4

{{cardinal|1,234th}}

1,234

{{cardinal|blahblah}}

blahblah

See also

  • {{ordinal}}, add an ordinal indicator to a cardinal number
  • {{digits}}, remove all characters from a string that are not digits
  • {{str number/trim}}, remove the first non-digit character and everything following
The above documentation is transcluded from Template:Cardinal/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:Cardinal&oldid=761025868"
Last edited on 20 January 2017, at 12:30

Languages

    • বাংলা
    • فارسی
    • Bahasa Indonesia
    • ਪੰਜਾਬੀ
    • తెలుగు
    • اردو
    • Tiếng Việt
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 20 January 2017, at 12:30 (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