Initials Formatter
The initials
formatter takes as a parameter any string and gets the first letter of each word.
This can be used for getting initials from a name to be used in an avatar icon.
The only restriction is that the Avatar control supports up to two letters inside the control.
format.initials(value, length?)
Param | Type | Required | Description | Since |
---|---|---|---|---|
value | string | Yes | Any valid string with spaces between the words. | 1.100 |
length | number | No | Any valid number will represent how many characters will be visible. Note: The default length of visualized characters is 2. | Note: If length is 2, first and last initial of a name will be shown.1.100 |
Returns | ||||
string | The first letter of every word in upper case. | 1.100 |
Examples
"sap.card": { "type": "List", "header": { "title": "Order status", "icon": { "initials": { "{= format.initials('John Doe')}" } } } }Try it Out