Add comma to numbers every three digits using C

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I want to add comma to decimal numbers every 3 digits using c#.
I wrote this code :

double a = 0; 
a = 1.5;
Interaction.MsgBox(string.Format("{0:#,###0}", a));

But it returns 2.
Where am I wrong ?
Please describe how can I fix it ?

Answers

 double a = 1.5;
Interaction.MsgBox(string.Format("{0:#,###0.#}", a));

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/6161254/add-comma-to-numbers-every-three-digits-using-c-sharp

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils