Answers for "how to center text in console c#"

C#
1

How to center text in console application

//copy this into your IDE
    //write your own text instead of "Custom Text" and run
    string textToEnter = "Custom Text";
    Console.WriteLine(String.Format("{0," + ((Console.WindowWidth / 2) + (textToEnter.Length / 2)) + "}", textToEnter));
    Console.Read();
Posted by: Guest on June-20-2021

C# Answers by Framework

Browse Popular Code Answers by Language