- Latest Version 1.128
- Version 1.126
- SAPUI Version 1.124
- SAPUI5 Version 1.122
- SAPUI5 Version 1.120
- SAPUI5 Version 1.118
- SAPUI5 Version 1.116
- SAPUI5 Version 1.114
- SAPUI5 Version 1.112
- SAPUI5 Version 1.110
- SAPUI5 Version 1.108
- SAPUI5 Version 1.106
- SAPUI5 Version 1.104
- SAPUI5 Version 1.102
- SAPUI5 Version 1.100
- SAPUI5 Version 1.98
- SAPUI5 Version 1.96
- SAPUI5 Version 1.94
- SAPUI5 Version 1.92
- SAPUI5 Version 1.88
- SAPUI5 Version 1.86
- SAPUI5 Version 1.84
- SAPUI5 Version 1.82
- SAPUI5 Version 1.80
- SAPUI5 Version 1.78
- SAPUI5 Version 1.76
- SAPUI5 Version 1.74
- SAPUI5 Version 1.72
- SAPUI5 Version 1.70
- SAPUI5 Version 1.68
- SAPUI5 Version 1.66
- SAPUI5 Version 1.64
- SAPUI5 Version 1.62
- SAPUI5 Version 1.60
- SAPUI5 Version 1.58
- SAPUI5 Version 1.56
- SAPUI5 Version 1.54
- SAPUI5 Version 1.52
- SAPUI5 Version 1.50
- SAPUI5 Version 1.48
- SAPUI5 Version 1.46
- SAPUI5 Version 1.44
- SAPUI5 Version 1.42
- SAPUI5 Version 1.40
- SAPUI5 Version 1.38
- SAPUI5 Version 1.36
- SAPUI5 Version 1.34
- SAPUI5 Version 1.32
- SAPUI5 Version 1.30
- SAPUI5 Version 1.28
- SAPUI5 Version 1.26
- Latest Version 1.128
- Version 1.126
- SAPUI Version 1.124
- SAPUI5 Version 1.122
- SAPUI5 Version 1.120
- SAPUI5 Version 1.118
- SAPUI5 Version 1.116
- SAPUI5 Version 1.114
- SAPUI5 Version 1.112
- SAPUI5 Version 1.110
- SAPUI5 Version 1.108
- SAPUI5 Version 1.106
- SAPUI5 Version 1.104
- SAPUI5 Version 1.102
- SAPUI5 Version 1.100
- SAPUI5 Version 1.98
- SAPUI5 Version 1.96
- SAPUI5 Version 1.94
- SAPUI5 Version 1.92
- SAPUI5 Version 1.90
- SAPUI5 Version 1.88
- SAPUI5 Version 1.86
- SAPUI5 Version 1.84
- SAPUI5 Version 1.82
- SAPUI5 Version 1.80
- SAPUI5 Version 1.78
- SAPUI5 Version 1.76
- SAPUI5 Version 1.74
- SAPUI5 Version 1.72
- SAPUI5 Version 1.70
- SAPUI5 Version 1.68
- SAPUI5 Version 1.66
- SAPUI5 Version 1.64
- SAPUI5 Version 1.62
- SAPUI5 Version 1.60
- SAPUI5 Version 1.58
- SAPUI5 Version 1.56
- SAPUI5 Version 1.54
- SAPUI5 Version 1.52
- SAPUI5 Version 1.50
- SAPUI5 Version 1.48
- SAPUI5 Version 1.46
- SAPUI5 Version 1.44
- SAPUI5 Version 1.42
- SAPUI5 Version 1.40
- SAPUI5 Version 1.38
- SAPUI5 Version 1.36
- SAPUI5 Version 1.34
- SAPUI5 Version 1.32
- SAPUI5 Version 1.30
- SAPUI5 Version 1.28
- SAPUI5 Version 1.26
Formatting Numbers
sap.ui.core.format.NumberFormat
Intro
This article describes the international rules for number formats. The SAPUI5 number formatters will help you to comply with these rules.
Usage
Use number formatting if:
- You need to display numbers based on the user’s locale settings.
Do not use number formatting if:
- You need to display IDs.
- You need to display telephone numbers.
Types
You can use four different data types for numbers: integer, float, currency, and percentage. Each data type can be formatted using a short, standard, or long format.
Integer
Use integer if no decimal places are required.
Short
Integer numbers formatted using the short form are truncated after three digits. When you use the short form, the units are shown as an abbreviation, such as K (thousand), M (million), or B (billion).
Number to format: 1567
United States (US): 1.57K
Germany (DE): 1.567
China (CN): 1,567
India (IN): 1.57 हज़ार
Number to format: 1567000
United States (US): 1.57M
Germany (DE): 1,57 Mio.
China (CN): 157万
India (IN): 15.7 लाख
Number to format: 1567000000
United States (US): 1.57B
Germany (DE): 1,57 Mrd.
China (CN): 15.7亿
India (IN): 1.57 अ॰
Standard
In general, use standard format. When you use standard format, integer numbers are displayed in full.
Number to format: 10000000
United States (US): 10,000,000
Germany (DE): 10.000.000
China (CN): 10,000,000
India (IN): 1,00,00,000
Long
Integer numbers formatted using the long form are truncated after three digits. The units are shown as full text, such as thousand, million, and so on.
Number to format: 1567
United States (US): 1.57 thousand
Germany (DE): 1,57 Tausend
China (CN): 1,567
India (IN): 1.57 हज़ार
Number to format: 1567000
United States (US): 1.57 million
Germany (DE): 1,57 Millionen
China (CN): 157万
India (IN): 15.7 लाख
Number to format: 1567000000
United States (US): 1.57 billion
Germany (DE): 1,57 Milliarden
China (CN): 15.7亿
India (IN): 1.57 अरब
Float
If you want to show decimal places, use float. The decimal places beyond the defined number of digits are truncated. If the minimum number of decimal digits is not restricted, only the trailing zeros are truncated, which could lead to very large numbers.
Short
Float numbers using the short form are displayed entirely without truncation of the trailing zeros. The units are displayed as an abbreviation, such as K (thousands), M (million), or B (Billion).
Number to format: 1590.5
United States (US): 1.59K
Germany (DE): 1.590,5
China (CN): 1,590.5
India (IN): 1.59 हज़ार
Number to format: 1590000.5
United States (US): 1.59M
Germany (DE): 1,59 Mio.
China (CN): 159万
India (IN): 15.9 लाख
Number to format: 1590000000.5
United States (US): 1.59B
Germany (DE): 1,59 Mrd.
China (CN): 15.9亿
India (IN): 1.59 अ॰
Standard
In general, use the standard format. Numbers using the standard format are displayed in full.
Number to format: 1590000.99
United States (US): 1,590,000.99
Germany (DE): 1.590.000,99
China (CN): 1,590,000.99
India (IN): 15,90,000.99
Long
Use the long format to show units as full text, such as thousands, million, and so on.
Number to format: 1590.5
United States (US): 1.6 thousand
Germany (DE): 1,6 Tausend
China (CN): 1,590.5
India (IN): 1.6 हज़ार
Number to format: 1590000.5
United States (US): 1.6 million
Germany (DE): 1,6 Millionen
China (CN): 159万
India (IN): 16 लाख
Number to format: 1590000000.5
United States (US): 1.6 billion
Germany (DE): 1,6 Milliarden
China (CN): 16亿
India (IN): 1.6 अरब
Currency
If you want to show currencies, use the currency formatter. Most currencies have two decimal places, although some need three digits after the decimal point, such as the Tunisian dinar. The currency formatter takes this into account. Currency amounts are rounded down automatically.
Short format TND 150مليو
Standard format TND 150,000,000.990
Long format TND 150 مليون
Short
Currency amounts that are greater than 1,000 and use the short format are abbreviated.
Number to format: 15000.99
United States (US): EUR 15.00K
Germany (DE): 15.000,99 EUR
China (CN): EUR 1.50万
India (IN): EUR 15.00 हज़ार
Number to format: 15000000.99
United States (US): EUR 15.00M
Germany (DE): 15,00 Mio. EUR
China (CN): EUR 1,500.00万
India (IN): EUR 1.50 क॰
Number to format: 15000000000.99
United States (US): EUR 15.00B
Germany (DE): 15,00 Mrd. EUR
China (CN): EUR 150.00亿
India (IN): EUR 15.00 अ॰
Standard
In general, use the standard format. Numbers using the standard format are displayed in full, including the decimal places.
Number to format: 15000000.99
United States (US): EUR 15,000,000.99
Germany (DE): 15.000.000,99 EUR
China (CN): EUR 15,000,000.99
India (IN): EUR 1,50,00,000.99
Long
Use the long format to show units as full text, such as thousand, million, and so on.
Number to format: 15000.99
United States (US): EUR 15.00 thousand
Germany (DE): 15,00 Tausend EUR
China (CN): EUR 1.50万
India (IN): EUR 15.00 हज़ा
Number to format: 15000000.99
United States (US): EUR 15.00 million
Germany (DE): 15,00 Millionen EUR
China (CN): EUR 1,500.00万
India (IN): EUR 1.50 करोड़
Number to format: 15000000000.99
United States (US): EUR 15.00 billion
Germany (DE): 15,00 Milliarden EUR
China (CN): EUR 150.00亿
India (IN): EUR 15.00 अरब
Percentage
If you want to show a percentage, use the percentage formatter.
Please note: Numbers formatted as a percentage are automatically multiplied by one hundred. This calculation is not shown in the following examples.
Short
Number to format: 246000%
United States (US): 246K%
Germany (DE): 246.000 %
China (CN): 246,000%
India (IN): 246 हज़ार%
Standard
Number to format: 246,000,000%
United States (US): 246,000%
Germany (DE): 246 Mio. %
China (CN): 2,460万%
India (IN): 24,600 लाख%
Long
Number to format: 246,000,000,000%
United States (US): 246B%
Germany (DE): 246 Mrd. %
China (CN): 2,460亿%
India (IN): 246 अ॰%
Guidelines
- In general, use the standard format.
- Follow the rules of the corresponding control to format the data appropriately. (For example, show 1.7M instead of 1,700,000 in the object list item.)
- Use float numbers to prevent truncation of decimal places.
- If you need to display amount fields without a value, leave them blank. Do not display a text as N/A.
- Always use the correct format according to your language or locale setting to prevent confusion caused by incorrect formatting. (For example, “200,000” is interpreted as “two hundred thousand” in the United States, but “two hundred point zero” in Germany.)
- If you need to display decimal numbers, use float and keep the number of digits after the decimal point to a minimum.
- Use object numbers where possible, for example, to display amounts in forms and responsive tables.
Resources
Want to dive deeper? Follow the links below to find out more about related controls, the SAPUI5 implementation, and the visual design.