Template:Ordinal  

From The Art and Popular Culture Encyclopedia

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:55, 20 April 2007
84.198.171.89 (Talk)

← Previous diff
Current revision
84.198.171.89 (Talk)

Line 1: Line 1:
-[http://en.wikipedia.org/wiki/{{PAGENAMEE}}] [Apr 2007]+{{{1|101}}}{{#ifeq: {{#expr: {{#expr: {{{1|101}}} mod 100 }} round -1}} | 10 | th
 + | {{#ifeq: {{#expr: {{{1|101}}} mod 10 }} | 1 | st
 + | {{#ifeq: {{#expr: {{{1|101}}} mod 10 }} | 2 | nd
 + | {{#ifeq: {{#expr: {{{1|101}}} mod 10 }} | 3 | rd
 + | th
 + }}
 + }}
 + }}
 +}}<noinclude>
 + 
 +This template will generate an appropriate ordinal suffix for a given number.
 + 
 +It could use stylesheet options for superscripted suffixes (i.e. ''101<sup>st</sup>'') and the ''-d'' suffixes used in the legal field (i.e. ''3d'' or ''22d'').
 +[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
 +[[Category:Mathematical function templates|{{PAGENAME}}]]
 + 
 +</noinclude>

Current revision

101{{#ifeq: {{#expr: {{#expr: 101 mod 100 }} round -1}} | 10 | th

| {{#ifeq: {{#expr: 101 mod 10 }} | 1 | st
   | {{#ifeq: {{#expr: 101 mod 10 }} | 2 | nd
      | {{#ifeq: {{#expr: 101 mod 10 }} | 3 | rd
        | th
        }}
     }}
  }}

}}

This template will generate an appropriate ordinal suffix for a given number.

It could use stylesheet options for superscripted suffixes (i.e. 101st) and the -d suffixes used in the legal field (i.e. 3d or 22d).

Personal tools