stringbuilder - How many spaces does \t use in c# -


i building report using stringbuilder , details of intended , aligned using

private static int paperwidth = 55; //it defines size of paper private static readonly string singleline = string.empty.padleft(paperwidth, '-'); stringbuilder reportlayout; reportlayout.appendline("\t" + "store name"); 



want store name in center , many such more feilds use of \t
in advance.

edit want print like. store name in center

if you're simulating tabs @ terminal should stick 8 spaces per tab. tab character shifts on next tab stop. default, there 1 every 8 spaces. in shells can edit whatever number of spaces want

you can realize through following code:

  string tab = "\t";   string space = new string(' ', 8);   stringbuilder str = new stringbuilder();   str.appendline(tab + "a");   str.appendline(space + "b");   string output = str.tostring(); // give 2 lines of equal length   int lengthofop = output.length; //will give 15 

from above example can in .net length of \t calculated 1


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -