Numeric Format Strings: X or x

LetterMeaning
X or xHexadecimal

using System;
using System.Text;
using System.Globalization;
class Sample
{
    public static void Main()
    {
        Console.WriteLine("{0:X}", 20);
        Console.WriteLine("{0:x}", 20);
        Console.WriteLine("{0:X4}", 20);

    }
}

The output:


14
14
0014

X for uppercase hex digits; x for lowercase hex digits.

X or x is for integrals only.

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.