Percent Formatter
The percent
formatter takes as a first parameter any string or number representing the
value of the percent to be formatted.
The second parameter is an object which defines the format options.
The third 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.percent(amount, options?, locale?)
Param | Type | Required | Description | Since |
---|---|---|---|---|
amount | string|number | Yes | Any valid string or number representing the percent to be formatted. | 1.74 |
options | object | No | Formatting options. | 1.74 |
locale | string | No | A string representing the locale code | 1.74 |
Returns | ||||
string | The formatted percent. | 1.74 |
Examples
A card with a percent
formatter
"sap.card": { "type": "List", "header": { "title": "Order status", "subTitle": "Orders exceeding {= format.percent(0.50)} are highlighted as important" } }Try it Out