Numbers::Ordinal provides two subs:
&ordinal_digit. If you type
ordinal(23), you get
ordinal_digit(23), and you get
23rd. Just a couple things about it:
&ordinal_digitdoesn’t exist yet.
- Don’t use numbers higher than 999 in
&ordinal, or you’ll get something like
-onetwo hundred thirty-fourthinstead of
one thousand, two hundred thirty-fourth.
- the tests curiously refuse to run. Feel free to find the problem :)
Anyways, it’s bound to be useful, at least for test writers, and it’s available right here.