LSCurrencyFormat()
Formats a number in a locale-specific currency format.
LSCurrencyFormat( number=object, type=string, locale=locale, useBrackets=boolean );
Returns: String
| Argument | Description | Default |
|---|---|---|
|
number
object,
required
|
edit
Currency value Alias: currency_number |
|
|
type
string,
optional
|
edit
|
local |
|
locale
locale,
optional
|
edit
Locale to use instead of the locale of the page when processing the function |
|
|
useBrackets
boolean,
optional
|
edit
When a number is negative, by default, it is wrapped in brackets Introduced: 6.2.3.19 |
true |
Examples
edit amount = 100;
locale = 'en_US';
writeoutput(LSCurrencyFormat( amount, 'local', locale )); // $100.00
writeoutput(LSCurrencyFormat( amount, 'international', locale )); // USD 100.00
writeoutput(LSCurrencyFormat( amount, 'none', locale )); // 100.00
locale = 'ja_JP';
writeoutput(LSCurrencyFormat( amount, 'local', locale )); // ¥100
writeoutput(LSCurrencyFormat( amount, 'international', locale )); // JPY 100
writeoutput(LSCurrencyFormat( amount, 'none', locale )); // 100
See also
- Currency features
- Strings
- Formatting
- Internationalization
- DollarFormat()
- LSEuroCurrencyFormat()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)