Double string.format

falukky picture falukky · Mar 26, 2012 · Viewed 41.4k times · Source

I have some double values I want to convert to a string with this pattern:

0.xx or x.xx

Currently I have try this:

double.ToString("#.#0");

What should I add in order to see zero in case my number start with zero?

Answer

Carsten picture Carsten · Mar 26, 2012

just use

myDouble.ToString("0.00")

that should do the trick