Numeric Format Strings: D

LetterMeaning
DPad with leading zeros

using System;
using System.Text;
using System.Globalization;
class Sample
{
    public static void Main()
    {
        Console.WriteLine("{0:D5}", 111);
        Console.WriteLine("{0:D1}", 10);
    }
}

The output:


00111
10

D is for integral types only.

D5 pads left to five digits and does not truncate.

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.