Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #center #text #console #application
ADD COMMENT
Topic
Name
7+1 =