Page tree

_num2words

The num2words formula converts numerals into words. For example, you can use the function to render "12" as "twelve," "twelfth," or "12th," or you can format it as currency. If you want to output words in another language, you can specify an alternate language code as the last parameter. The currency option requires a language to be specified in order to identify the appropriate currency.

The format options are cardinal; ordinal; ordinal_num, which renders the ordinal format with numerals; and currency, which requires a language code.

The first input parameter must be a numerical value. For ordinal formatting, the number must be an integer. The default format is cardinal, and the default language is U.S. English.

Syntax

num2words(value, "format", "language")

Examples

num2words(12.76, "cardinal")
twelve point seven six
num2words(39, "ordinal")
thirty-ninth
num2words(39, "ordinal_num")39th
num2words(39, "currency", "es")treinta y nueve euros
num2words(39, "currency", "en")thirty-nine U.S. dollars

CONTENTS