Format integer with eight hexadecimal digits : int format « Data Types « C# / C Sharp






Format integer with eight hexadecimal digits

   

using System;
using System.Globalization;

public class Example
{
   public static void Main()
   {
      int[] numbers = { -111, 0, 169, 11111 };
      foreach (int number in numbers) {
         // Display value with eight hexadecimal digits.
         Console.WriteLine("{0,14:X8}", number);
      }
   }
}
/*

      FFFFFF91
      00000000
      000000A9
      00002B67


*/

   
    
    
  








Related examples in the same category

1.Format integer: C
2.Format integer with default formatting
3.Format integer with 3 digits and leading zeros
4.Format integer with 1 decimal digit
5.Format integer as hexadecimal
6.Format integer as octal and binary numbers
7.Use standard numeric format specifier: C
8.Use standard numeric format specifier: D8
9.Use standard numeric format specifier: E4
10.Use standard numeric format specifier: e3
11.Use standard numeric format specifier: F
12.Use standard numeric format specifier: N
13.Use standard numeric format specifier: P
14.Use standard numeric format specifier: X
15.Use standard numeric format specifier: 0,0.000
16.Use standard numeric format specifier: #,#.00#;(#,#.00#)
17.Int32.ToString (IFormatProvider)
18.Int32.ToString Method (String)
19.Int32.ToString Method (String, IFormatProvider)
20.Int32.ToString Converts the numeric value of this instance to its equivalent string representation.
21.double value format vs int value format
22.Add Ordinal Suffix
23.Converts an integer into a roman numeral.