Format Syntax > Number Formats
 
Number Formats
Number formats refer to the formatting of numbers, including currency amounts. You can use the following symbols to specify a number format.
Symbol
Description
0
Placeholder for a mandatory digit
#
Placeholder for an optional digit
.
Placeholder for the decimal point
,
Placeholder for the thousands separator
%
Formats the value as a percentage
E
Placeholder for the exponent (displayed in uppercase)
e
Placeholder for the exponent (displayed in lowercase)
The exponent symbols “E” and “e” may be followed by a “+” or “-” sign. A “-” sign means that the exponent sign must be displayed only if it is negative, whereas a “+” sign or no sign means that the sign of the exponent is always displayed.
When a “%” sign appears in the format specification, the numeric value to be formatted is multiplied by 100 before formatting and a “%” sign appears in the result.
0” symbols are replaced by zeros when there is no corresponding digit in the number value.
Examples
Value
Format
Result
1234.567
#,##0.00
1 234.57
1234.567
#,##0.0#
1 234.57
1234.5
#,##0.00
1 234.50
1234.5
#,##0.0
1 234.5
1.5
0,000.00
0 001.50
1234
0.00 E+00
1.23 E+03
1234
0.00 E-00
1.23 E03
1234
0.00 E-##
1.23 E3
0.5432
#.# %
54.3 %
The characters used to represent the decimal point and the thousands separator in the formatted result depend on application settings that can be changed. Typically, they depend on the country where the application is used. These settings do not affect the symbols used as placeholders for the decimal point and for the thousands separator in format specifications. You should thus always use the placeholders listed above for these values as only the output depends on the application settings.
Note that the maximum precision is 15 digits for double values and 7 for float values.

Version 5.6
Copyright © 2012, Rogue Wave Software, Inc. All Rights Reserved.