Afficher un message
Vieux 06/12/2007, 18h33   #1
Tenacious
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut formating a double value does not work as expected

Can anyone tell me why strSpd2 in the example below ends up being a
blank string when formatting a zero value? It would seem to me that
strSpd2 should end up being "0.0"

double val1 = 14.38009
double val2 = 0.0;
string strSpd1 = "";
string strSpd2 = "";

// This formats correctly. strSpd1 = "14.4"
strSpd1 = String.Format("{0:##.#}", val1);

// This does not format. strSpd2 = ""
strSpd2 = String.Format("{0:#.#}", val2);

  Réponse avec citation
 
Page generated in 0,04365 seconds with 9 queries