C# String.Format() strategy with Example: Here, we will find out about the custom arranging of integer numbers in C#.
Here is the portion of the examples of custom organizing of integer numbers in C#.
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Demo for custom formatting of an integer number:");
Console.WriteLine(String.Format("{0:+#### #### ####}" , 1234567891012));
Console.WriteLine(String.Format("{0:##-##-####}", 21102019));
Console.WriteLine(String.Format("{0:##/##/####}", 21102019));
Console.WriteLine();
}
}
}
Output:
Demo for custom formatting of an integer number:
+12345 6789 1012
21-10-2019
21/10/2019
In the above program, we printed sign ‘+‘ and printed the numbers in 4 digits multiple times. What’s more, here we printed the date additionally with image ‘- ‘ and ‘/’.