Number to Words (Ordinal)
Converts a number, numeric string, or cardinal word string into its ordinal word representation.
numberToWordsOrdinal
The numberToWordsOrdinal function converts a number, numeric string, or cardinal word string into its ordinal word representation (e.g. "first", "twenty-third" etc.).
Warning
- Supports only values up to
10e19(10^20) (one hundred quintillion). - Decimal values are ignored; only the integer part is processed.
Function Signature
function numberToWordsOrdinal(number: Numeric | string): stringParameters
number(Numeric | string): A number (e.g.42), numeric string (e.g."42"), or cardinal word string (e.g."forty-two").
Return Value
string: The ordinal word version of the input, always in lowercase.
Example Usage
playground.ts
Notes
- Case-insensitive input handling (
"Twenty-Three"also works). - Internally uses numberToWords to convert a numeric value to cardinal words before resolving the ordinal form.
Aliases
The following aliases can be used for the numberToWordsOrdinal function:
cardinalWordsToOrdinalconvertNumberToWordsOrdinal
See Also
- numberToWords - For cardinal word representation of numbers.
- wordsToNumber - For converting English word numbers back to digits.
Last updated: Mon, Jun 15, 2026 11:04:47AM (UTC)
