2010-12-04 6 views

Répondre

5

Vous pouvez utiliser l'alignement:

String.Format("{0,10:F3}", -123.321) 

où 10 est la longueur PRÉFÉRÉ.

Voir Composite Formatting.

3

trouvé un article rapide, bref:

String.Format("{0,10:0.0}", 123.4567); // "  123.5" 
String.Format("{0,-10:0.0}", 123.4567); // "123.5  " 
String.Format("{0,10:0.0}", -123.4567); // " -123.5" 
String.Format("{0,-10:0.0}", -123.4567); // "-123.5 " 

Source: Here < - Regardez ici pour plus.

Questions connexes