Friday, November 9, 2007

Formatting Numbers With 2 Digits Of Precision

Here it is.. simple but I always forget it.

Example:

19.ToString( "F" );
19.ToString( "#0.00" );

Also, this is how to format a number with a leading zero if it is one digit. For example, 3 should be 03:

3.ToString( "00" );

See: Double.ToString Method (String)

No comments:

eXTReMe Tracker