TerribleDev
TerribleDev

Reputation: 2245

In dotnet How many characters in a console column

In this msdn post it says Console.WindowWidth is measured in "columns" how many characters fit in one column?

https://msdn.microsoft.com/en-us/library/system.console.windowwidth(v=vs.110).aspx

Upvotes: 1

Views: 290

Answers (2)

Gene
Gene

Reputation: 21

Some characters such as U+0FF0F FULLWIDTH SOLIDUS are two columns wide, e.g. try:

using System.Diagnostics;

// put Console into UTF-8 mode
Process chcp = new Process();
chcp.StartInfo.FileName = "chcp.com";
chcp.StartInfo.Arguments = "65001";
chcp.Start();
chcp.WaitForExit();

char chr = '/'; // U+0FF0F FULLWIDTH SOLIDUS
Console.WriteLine($"1234\na{chr}b"); // / takes two columns
Console.ReadKey();

Upvotes: 0

riwalk
riwalk

Reputation: 14233

There is 1 character per column

Upvotes: 3

Related Questions