a format question

  • Thread starter Thread starter Ned White
  • Start date Start date
N

Ned White

Hi All,

when i use "{0:#,#.##}" format string for decimal values it seems like that;
12,1457 --> 12,15
45,4119 --> 45,41

but for one decimal digit values it does not show zero after first decimal
digit.
12,4000 --> 12,4
78,8000 --> 78,8
45,5000 --> 45,5

are there any format string to show zero after decimal digit like that;
12,4000 --> 12,40
78,8000 --> 78,80
45,5000 --> 45,50

Thanks ..

White..
 
Ned said:
Hi All,

when i use "{0:#,#.##}" format string for decimal values it seems like that;
12,1457 --> 12,15
45,4119 --> 45,41

but for one decimal digit values it does not show zero after first decimal
digit.
12,4000 --> 12,4
78,8000 --> 78,8
45,5000 --> 45,5

are there any format string to show zero after decimal digit like that;
12,4000 --> 12,40
78,8000 --> 78,80
45,5000 --> 45,50

I think you want
"{0:#,##0.00}"
 
Hi All,

when i use "{0:#,#.##}" format string for decimal values it seems like that;
12,1457 --> 12,15
45,4119 --> 45,41

but for one decimal digit values it does not show zero after first decimal
digit.
12,4000 --> 12,4
78,8000 --> 78,8
45,5000 --> 45,5

are there any format string to show zero after decimal digit like that;
12,4000 --> 12,40
78,8000 --> 78,80
45,5000 --> 45,50

Use "{0:#,0.00}" - look at the docs for the difference between 0 and #
in a format string.
 
Back
Top