LocalizeCurrency (open)

Format a currency value

Syntax

LOADLIB "wh::util/localization.whlib";

STRING FUNCTION LocalizeCurrency(VARIANT value, INTEGER decimals, BOOLEAN grouping, STRING currency, STRING locale)

Parameters

VARIANT value

The value to format, an INTEGER, INTEGER64, MONEY or FLOAT

INTEGER decimals

The number of decimals to show, or -1 to use the default number of decimals for the specified currency (the value will be rounded to the number of decimals)

BOOLEAN grouping

If the digits should be grouped using a thousand separator

STRING currency

The currency to use (e.g. 'EUR' or 'USD')

STRING locale

The language or locale to use (e.g. 'en', 'en-GB', 'nl' or 'zh-Hans-CN')

Return value

STRING

The formatted value

Examples

// example1 = "€12,345.68"
STRING example1 := LocalizeCurrency(12345.6789, -1, TRUE, "EUR", "en");

// example2 = "US$\u00A012.346"
STRING example2 := LocalizeCurrency(12345.6789, 0, TRUE, "USD", "nl");