I was about to write a C++ function doing the following:
1 ---> "1st"
2 ---> "1nd"
3 ---> "3rd"
...
17657 --> "17657th"
...
i.e. produces the ordinal extension string for that number (it doesn't have to do an itoa()
of the number itself). But then I thought "surely something in the standard library or boost does this already?"
Notes:
- I know it's not hard to write this, there's an implementation in Python right here on SO, I just don't want to duplicate code.
- I need this in English, obviously. A multi-language version would be nice for political-correctness considerations, not more than that...