Response.Write(String.Format("{0:#,###.##}",0)); returns empty string

  • Thread starter Thread starter Von Shean
  • Start date Start date
V

Von Shean

I use the following code to format the numbers to have commas. But in case
when input is zero it returns an empty string....any ideas?

String.Format("{0:#,###.##}",dblNum);
 
Von said:
I use the following code to format the numbers to have commas. But in case
when input is zero it returns an empty string....any ideas?

String.Format("{0:#,###.##}",dblNum);

You want something like:

String.Format("{0:#,##0.00}",dblNum);

depending on whether or not you always want to display 2 digits after
the decimal.
 
Back
Top