visual studio - /t not working in C# console -
when put \t in console.writelin()
doesn't work
if (reader.hasrows) { console.writeline("|{0}|\t|{1}|\t|{2}|\t|{3}|\t|{4}|", reader.getname(0), reader.getname(1), reader.getname(2), reader.getname(3), reader.getname(4)); while (reader.read()) { console.writeline("|{0}|\t|{1}|\t|{2} egp|\t|{3} egp|\t|{4}|", reader.getstring(0), reader.getint32(1), reader.getint32(2), reader.getint32(3), reader.getstring(4)); } }
the result ::
|product name| |quantity| |price per item | |total| |code| |a| |1| |0 egp| |1 egp| |12|
even when use {0,10}
or {0,-10}
not working
thank you.
yes, it's work. sould imagine tabs columns markers. when put \t saying console: jump next available column mark. in header 'product name' has revased first tab column, when console process \t, jumps 2nd column. instead, in data, 'a' small enought , can jump 1st column.
this output correct format:
console.writeline(string.format("|{0,-15}|", "product name")); console.writeline(string.format("|{0,-15}|", "a"));
you can see working @ http://rextester.com/tuvx20333
Comments
Post a Comment