Use string.Format to format integer : String Format : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » String Format »

 

Use string.Format to format integer








    
 
using System;

public class TestConsoleApp {
    public static void Main(string[] args) {
        string s = string.Format("123");
        string t = string.Format("{0}", 123);
        string u = string.Format("{0:D3}", 123);
        Console.WriteLine(s);
        Console.WriteLine(t);
        Console.WriteLine(u);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» String Format