Template:Ordinal: Difference between revisions

From Roses, Tulips, & Liberty
Content added Content deleted
m (Robot - Moving category Mathematical templates to Mathematical function templates per CFD at Wikipedia:Categories for discussion/Log/2007 January 19.)
(minor edits; reduced template size)
Line 1: Line 1:
{{{1|101}}}{{#ifeq: {{#expr: {{#expr: {{{1|101}}} mod 100 }} round -1}} | 10 | th
{{{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}}|1|st
| {{#ifeq: {{#expr: {{{1|101}}} mod 10 }} | 2 | nd
|{{#ifeq:{{#expr:{{{1|101}}} mod 10}}|2|nd
| {{#ifeq: {{#expr: {{{1|101}}} mod 10 }} | 3 | rd
|{{#ifeq:{{#expr:{{{1|101}}} mod 10}}|3|rd
| th
|th
}}
}}
}}
}}
}}
}}
}}<noinclude>
}}<noinclude>
{{/doc}}</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>

Revision as of 19:47, 8 May 2007