Meraj99 Meraj99 - 8 months ago 63 Question

How to center text in (Console)

I want to print text "TEST" (Console.WriteLine) in the center of my console application. How would I go about doing so?

Looking for 'beginner-friendly' answers.

Answer Source

You'll need to get the console with, get the length of the string you're about to display and, subtract the second from the first, divide this in half and pad the string with this number of spaces.