c# - How to print variable into empty space without pushing the next text on same line further to the right? -


so im working on school assignment im supposed make console version of old game jeopardy(using visual studio) ive come across issue im not sure how fix.

thing im have array categories , 5 variables(kat1+2+3+4+5) select these categories @ random. problem name of categories differ in length , supreme designed category table doesn't fit anymore. have tips how print variable "empty" spaces without pushing | right?

------------------------------------------------------------------"); console.writeline("|  "+kat1+"  | "+kat2+"   |   "+kat3+" | "+kat4+"   |   "+kat5+"   |"); console.writeline("--------------------------------------------------"); console.writeline("|            |            |            |            |            |"); console.writeline("--------------------------------------------------"); console.writeline("|            |            |            |            |            |"); console.writeline("---------------------------------------------------"); console.writeline("|            |            |            |            |            |"); console.writeline("---------------------------------------------------"); console.writeline("|            |             |           |            |     |"); console.writeline("---------------------------------------------------"); console.writeline("|            |             |           |            |          |"); console.writeline("---------------------------------------------------"); console.readline(); 

you should string formatting.

string result = string.format("{0}: {1:0.0} - {2:yyyy}",     value1,     value2,     value3); // write result. console.writeline(result); 

from http://www.dotnetperls.com/string-format


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -