This page is a draft and may contain incorrect information and/or experimental styling.
FormatNumeric
Overview
Standard Numeric Format Strings
Format Specifier | Description | Example (Value = 1234.567) |
C | Currency | {0:C} → $1,234.57 |
D | Decimal (integer values only) | {0:D5} → 01234 |
E | Exponential (scientific) | {0:E} → 1.234567E+003 |
F | Fixed-point | {0:F2} → 1234.57 |
G | General (most compact of F or E) | {0:G} → 1234.567 |
N | Number (includes thousand separators) | {0:N} → 1,234.57 |
P | Percent | {0:P} → 123,456.70% |
X | Hexadecimal (uppercase or lowercase) | {0:X} → 4D2 |
Custom Numeric Format Strings
Character | Description | Example (Value = 1234.567) |
0 | Zero placeholder (pads with zeros) | {0:00000} → 01234 |
# | Digit placeholder (skips extra digits) | {0:#.##} → 1234.57 |
. | Decimal point | {0:0.00} → 1234.57 |
, | Thousands separator | {0:#,##0} → 1,234 |
% | Percentage | {0:0%} → 123457% |
E0 | Scientific notation | {0:0.0E0} → 1.2E3 |
Related