3

I would like to apply string.Format() in such a way that it performs truncation instead of rounding. For example

string.Format("##", 46.5); // output is 47, but I want 46
string.Format("##.#", 46.55); // output is 46.6, but I want 46.5
ChaseMedallion
  • 20,860
  • 17
  • 88
  • 152
  • http://stackoverflow.com/questions/164926/c-sharp-how-do-i-round-a-decimal-value-to-2-decimal-places-for-output-on-a-pa – Niventh Mar 29 '13 at 15:31

1 Answers1

0

Use Math.Truncate to truncate before formatting for output

Iswanto San
  • 18,263
  • 13
  • 58
  • 79
Michael Ross
  • 572
  • 4
  • 7