Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Developer's Guide
Custom Numeric Format Strings Output Examples
[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

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)

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker