Category:

Miscellaneous

Converts a number to its representation in words.

Syntax

number_to_words(
  x Numeric,
  Language String,
  Options String
): String

Parameters

x is the original number.

Language is the code of the language in which the result must be represented. Possible values: 'en-US' (American English), 'uk-UA' (Ukrainian).

Options is a pipe separated list of options in OptionName=OptionValue format.
Allowed options:
- ShowZeroSubunits. Instructs either to include fractional part of the number if it equals to zero. Possible values: True or False. Default value: False.
- ProcessSubunits. Instructs either to convert fractional part of the number to words. Possible values: True or False. Default value: False.
- UnitsSubunitsSeparator. Specifies a separator between an integer and fractional parts of the number. Default value is a space character.
- SubunitsDimension. Specifies dimension for fractional part of the number. Default value is 2. This option is ignored when ProcessSubunits is True.
- CurrencyCode. Specifies currency code in ISO 4217 format. Currently, only the following currency codes are supported: USD, EUR, UAH. Using this option instructs to interpret the number as currency value and add main currency and fractional currency names (i.e., units and sub-units).
- Type. Specifies the type of the conversion. Possible values: regular, fraction. This option is meaningful only if Language is 'uk-UA'.
- UnitsShortened. Instructs to shorten the main currency name (units) if it is used. This option is meaningful only if Language is 'uk-UA'.
- SubunitsShortened. Instructs to shorten the fractional currency name (sub-units) if it is used. This option is meaningful only if Language is 'uk-UA'.

Return value

Type: String. Returns the resulting string.

Examples of using

number_to_words(dataset_field_val(1, 'pay_sum'), 'en-US', 'UnitsSubunitsSeparator= and |CurrencyCode=USD|SubunitsDimension=2|ShowZeroSubunits=true')
number_to_words(3467.35, 'en-US', 'UnitsSubunitsSeparator= and |CurrencyCode=USD|ShowZeroSubunits=true')

Result: three thousand four hundred sixty seven dollars and 35 cents

number_to_words(3467.35, 'en-US', 'UnitsSubunitsSeparator= and |SubunitsDimension=4|ShowZeroSubunits=true')

Result: three thousand four hundred sixty seven and 3500