문자열 서식 왼쪽/오른쪽 맞추기

string result = string.Format("{0}DEF", "ABC");
// result : "ABCDEF"
string result = string.Format("{0, -10}DEF", "ABC");
// result : "ABC       DEF"
string result = string.Format("{0, 10)DEF", "ABC");
// result : "      ABCDEF"

예제)

class MainApp
    {
        static void Main(string[] args)
        {
            string fmt = "{0, -20}{1, -15}{2, 30)";

            Console.WriteLine(fmt, "Publisher", "Author", "Title");
            Console.WriteLine(fmt, "Marvel", "Stan Lee", "Iron Man");
            Console.WriteLine(fmt, "Hanbit", "Sanghyun Park", "This is C#");
            Console.WriteLine(fmt, "Prentice Hall", "K&R", "The C Programing Language");

            // Publisher        Author                               Title
            // Marvel           Stan Lee                          Iron Man
            // Hanbit           Sanghyun Park                   This is C#
            // Prentice Hall    K&R              The C Programing Language
        }
    }