Numeric Format Strings

Numeric format strings control formatting operations in which a numeric data type is represented as a string.

Numeric format strings fall into two categories:

  • Standard numeric format strings.

    Standard numeric format strings consist of one of a set of standard numeric format specifiers. Each standard format specifier denotes a particular, commonly used string representation of numeric data.

  • Custom numeric format strings.

    Custom format strings consist of one or more custom numeric format specifiers. Combine custom numeric format specifiers to define an application-specific pattern that determines how numeric data is formatted.

Numeric format strings are supported by the ToString method of numeric types. Numeric format strings are also supported by the .NET Framework composite formatting feature, which is used by certain Write and WriteLine methods of the Console and StreamWriter classes, the String.Format method, and the StringBuilder.AppendFormat method.

See Also

Concepts

Formatting Overview

Standard Numeric Format Strings

Custom Numeric Format Strings

Other Resources

Formatting Types