Numeric Format Strings:F

LetterMeaning
FFixed point

using System;
using System.Text;
using System.Globalization;
class Sample
{
    public static void Main()
    {
        Console.WriteLine("{0:F2}", 1.2345);
        Console.WriteLine("{0:F2}", 0.00001);
    }
}

The output:


1.23
0.00

F2 rounds to two decimal places.

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.