Custom Numeric Format Strings Output ExamplesÂ
The following table illustrates the output created by applying some custom numeric format strings to specific data types and values. The output was generated using the ToString method and the English-United States (en-US) culture.
The Format string column indicates the format string, the Data type column indicates the data type used, the Value column indicates the value of the number being formatted, and the Output column indicates the result of formatting.
Format string | Data type | Value | Output |
---|---|---|---|
##### |
Double |
123 |
123 |
00000 |
Double |
123 |
00123 |
(###) ### - #### |
Double |
1234567890 |
(123) 456 – 7890 |
#.## |
Double |
1.2 |
1.2 |
0.00 |
Double |
1.2 |
1.20 |
00.00 |
Double |
1.2 |
01.20 |
#,# |
Double |
1234567890 |
1,234,567,890 |
#,, |
Double |
1234567890 |
1235 |
#,,, |
Double |
1234567890 |
1 |
#,##0,, |
Double |
1234567890 |
1,235 |
#0.##% |
Double |
0.086 |
8.6% |
0.###E+0 |
Double |
86000 |
8.6E+4 |
0.###E+000 |
Double |
86000 |
8.6E+004 |
0.###E-000 |
Double |
86000 |
8.6E004 |
[##-##-##] |
Double |
123456 |
[12-34-56] |
##;(##) |
Double |
1234 |
1234 |
##;(##) |
Double |
-1234 |
(1234) |
See Also
Concepts
Custom Numeric Format Strings
Standard Numeric Format Strings