polymerist.genutils.textual.ordinals

Tools for converting back and forth between integers and ordinal number words and prefices (https://en.wikipedia.org/wiki/Ordinal_numeral)

Functions

ordinal_suffix_from_int(→ str)

Produce the appropriate word suffix for an integer in sequential order

ordinal_suffix_from_int_alt(→ str)

Produce the appropriate word suffix for an integer in sequential order

ordinal_from_int(→ str)

Produce the word representation of an integer sequential order

Module Contents

polymerist.genutils.textual.ordinals.ordinal_suffix_from_int(n: int) str[source]

Produce the appropriate word suffix for an integer in sequential order E.g 1 -> “st” as in “first”, 17 -> “th” as in “seventeenth, etc.

polymerist.genutils.textual.ordinals.ordinal_suffix_from_int_alt(n: int) str[source]

Produce the appropriate word suffix for an integer in sequential order E.g 1 -> “st” as in “first”, 17 -> “th” as in “seventeenth, etc.

An alternative, slightly-slower but aesthetically-pleasing implementation

polymerist.genutils.textual.ordinals.ordinal_from_int(n: int) str[source]

Produce the word representation of an integer sequential order E.g 1 -> “1st”, 17 -> “seventeenth”, 33 -> “33rd”, etc.