C# Column formatting

后端 未结 5 1777
失恋的感觉
失恋的感觉 2021-01-07 09:27

I\'m trying to format some output to the console but having some problems with a solution. I\'m doing it in C# but everything time I call Console.Write it prints the the ent

5条回答
  •  鱼传尺愫
    2021-01-07 09:53

    To start a new line:

    Console.WriteLine();
    

    For example:

    var names = str.Split();
    for (int i = 0; i < names.Length; i++)
    {
        Console.Write(names[i] + '\t');
        if ((i + 1) % 4 == 0)
            Console.WriteLine();
    }
    

提交回复
热议问题