Converting double to string

  • Thread starter Thread starter arun.hallan
  • Start date Start date
A

arun.hallan

Hi,

I am using the following command to convert a double to string:

string.ToString("#.00")

So 8.888 becomes 8.89.
But 0.8888 becomes .89

How do i process the string so it retains the leading 0 to become
'0.89'

Thanks
Arun
 
Hi Arun,

Will this work ?

double num = 0.80;
Console.WriteLine(num.ToString("N"));

Regards,
C.C.Chakkaradeep
 
Hi,

I am using the following command to convert a double to string:

string.ToString("#.00")

So 8.888 becomes 8.89.
But 0.8888 becomes .89

How do i process the string so it retains the leading 0 to become
'0.89'

Thanks
Arun

double d = 0.88d;
string s = d.ToString("0.00");

works for me :)

HTH,
Mythran
 
Back
Top