Template:Ordinal  

From The Art and Popular Culture Encyclopedia

Jump to: navigation, search

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