How do I convert a decimal value to a string of decimal digits (0-9), prefixed by a minus sign?
Decimal paymentAmt = -871.00M;
I need it formatted to: -000000871.00
The format parameter can be any valid standard numeric format specifier except for D, R, and X, as well as any combination of custom numeric format specifiers.
You can use
ToStringto format it, check out MSDN for Custom Numeric Format Strings.The above prints the following to the
Console:I am using the Zero Placeholder: