Reputation: 36682
I'm calling the below method with 0.02
public static string FormatAsDecimalWithCommaSeperator(decimal value)
{
return String.Format("{0:#,###,###.##}", value);
}
returns .02
All I want to do is to leave two decimal digits and leave the zero left to the decimal point. Meaning in that case it should have returned "0.02"
How can I fix this?
Upvotes: 0
Views: 557
Reputation: 46629
You could easily have googled. Here, I found this.
http://www.csharp-examples.net/string-format-double/
So the answer is "{0:#,###,##0.##}"
Upvotes: 2