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 valueThe value to format, an INTEGER, INTEGER64, MONEY or FLOAT
INTEGER decimalsThe 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 groupingIf the digits should be grouped using a thousand separator
STRING currencyThe currency to use (e.g. 'EUR' or 'USD')
STRING localeThe language or locale to use (e.g. 'en', 'en-GB', 'nl' or 'zh-Hans-CN')
Return value
STRINGThe 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");