Number Format Masks


.NET Number and Currency Format Masks

 

Standard Format Masks

Standad masks which vary based on the culture being used

Character Description Example (US English)
c,C Standard currency format $20.99
d,D Standard decimal format 20.99
e,E Standard Scientific (exponential) format  
f,F Standard Fixed-point format 20.99
g,G General format 20.99
n,N Number format 20.99

 

Custom Format Masks

A custom numeric format pattern is specified using the following format: <.> For Example, to display 4 decimal precision with a leading sign, use the mask: -9999.9999

Component Description
<sign> A negative sign or positive sign symbol (+ or -)
<integral-digits> A series of digits specifying the integral part of the number (left of the decimal
indicator)
<.> A culture-specific decimal point symbol
<fractional-digits> A series of digits specifying the fractional part of the number (right of the decimal
indicator)