Float Formatter
The float
formatter takes as a first parameter any string or number representing the value
of the floating-point number 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.float(amount, options?, locale?)
Param | Type | Required | Description | Since |
---|---|---|---|---|
amount | string|number | Yes | Any valid string or number representing the floating-point number 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 floating-point number. | 1.74 |
Examples
A card with a float
formatter using {decimals:2, style:'short'}
as format
options and 'de'
as custom locale
"sap.card": { "type": "List", "header": { "title": "Order status", "subTitle": "Orders exceeding {= format.float(50.00, {decimals:2, style:'short'}, 'de' )} are highlighted as important" } }Try it Out