Numeric formatting symbols

The following table lists the symbols you can use to specify a numeric format.

Table 1. Numeric formatting symbols
SymbolMeaning
#A digit that uses a space as the fill character for a leading zero (unless the < character is also present).
*A digit that uses an asterisk (*) as the fill character for a leading zero (unless the < character is also present).
&A digit that uses a zero as the fill character for a leading zero (unless the < character is also present).
<Left justify the number. Leading zeros are not represented in the output.
,Use a locale-dependent numeric separator unless the position contains a leading zero.
. Use a locale-dependent decimal point.
-Use a minus sign (-) for values less than 0; use a space for values greater than or equal to 0.
+Use a minus sign for values less than 0; use a plus sign (+) for values greater than or equal to 0.
(...)Enclose negative values with parentheses. The positions of the parentheses in the format string determine their positions in the result.
$Precede the value with the locale-dependent currency symbol. This symbol is useful only when you place it at the beginning of the pattern.
@Place the locale-dependent currency symbol after the value.

Examples

In the table below, the letter "b" represents a blank space.

Table 2.
Format StringData ValueFormatted Result Comments
"#####"0bbbbbNo zero symbol
"&&&&&" 000000
"$$$$$" 0bbbb$ No zero symbol
"*****"0*****No zero symbol
"<<<<<"0(empty string)
"<<<,<<<" 1234512,345
"<<<,<<<" 12341,234
"<<<,<<<" 123123
"<<<,<<<" 1212
"##,###" 1234512,345
"##,###" 1234b1,234
"##,###" 123bbb123
"##,###" 12bbbb12
"##,###" 1bbbbb1
"##,###" -1bbbbb1 No negative sign
"&&,&&&"12345 12,345
"&&,&&&"123401,234
"&&,&&&" 123000123
"&&,&&&" 12000012
"&&,&&&" 1000001
"&&,&&&" -1000001 No negative sign
"&&,&&&"0 000000
"&&,&&&.&&" 12345.6712,345.67
"&&,&&&.&&" 1234.5601,234.56
"&&,&&&.&&" 123.45000123.45
"&&,&&&.&&" 0.01000000.01
"$$,$$$" 12345****** Overflow
"$$,$$$" 1234$1,234
"$$,$$$" 123bb$123
"$$,$$$" 12bbb$12
"$$,$$$" 1bbbb$1
"$$,$$$" 0bbbbb$ No zero symbol