Int32.ToString Converts the numeric value of this instance to its equivalent string representation. : int format « Data Types « C# / C Sharp






Int32.ToString Converts the numeric value of this instance to its equivalent string representation.

   

using System;
using System.Globalization;

public class ParseInt32
{
   public static void Main()
   {

      int value = -16325;
      // Display value using default ToString method.
      Console.WriteLine(value.ToString());            
      // Display value using some standard format specifiers.
      Console.WriteLine(value.ToString("G"));         
      Console.WriteLine(value.ToString("C"));         
      Console.WriteLine(value.ToString("D"));         
      Console.WriteLine(value.ToString("F"));         
      Console.WriteLine(value.ToString("N"));         
      Console.WriteLine(value.ToString("X"));         
   }
}
/*
-16325
-16325
($16,325.00)
-16325
-16325.00
-16,325.00
FFFFC03B


*/

   
    
    
  








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 with eight hexadecimal digits
7.Format integer as octal and binary numbers
8.Use standard numeric format specifier: C
9.Use standard numeric format specifier: D8
10.Use standard numeric format specifier: E4
11.Use standard numeric format specifier: e3
12.Use standard numeric format specifier: F
13.Use standard numeric format specifier: N
14.Use standard numeric format specifier: P
15.Use standard numeric format specifier: X
16.Use standard numeric format specifier: 0,0.000
17.Use standard numeric format specifier: #,#.00#;(#,#.00#)
18.Int32.ToString (IFormatProvider)
19.Int32.ToString Method (String)
20.Int32.ToString Method (String, IFormatProvider)
21.double value format vs int value format
22.Add Ordinal Suffix
23.Converts an integer into a roman numeral.