Converting double to string

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
 
G

Guest

Hi Arun,

Will this work ?

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

Regards,
C.C.Chakkaradeep
 
M

Mythran

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top