Currency Formatter
The currency
formatter takes as a first parameter the currency value as a string or number.
The second parameter is a string that represents the currency ISO code, and the third parameter is an
object which defines the format options.
The fourth optional parameter is a string representing a custom locale code. If no locale is given the
current user locale is used.
The options
and locale
parameters are optional and can be omitted. If only
options
is omitted
the locale
will be shifted in its place.
format.currency(amount, currency, options?, locale?)
Param | Type | Required | Description | Since |
---|---|---|---|---|
amount | string|number | Yes | Any valid string or number representing the amount of currency to be formatted. | 1.74 |
currency | string | Yes | A string that represents the currency ISO code. | 1.74 |
options | object | No | Formatting options. | 1.74 |
locale | string | No | A string representing the locale code | 1.74 |
Returns | ||||
string | The formatted currency. | 1.74 |
Examples
A card with a currency formatter using expression binding for Euro with {currencyCode:false}
as format options
"sap.card": { "type": "List", "header": { "title": "Order status", "subTitle": "Orders exceeding {= format.currency(12345.678, 'EUR', {currencyCode:false}, 'de')} are highlighted as important" } }Try it Out