473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

formatting console app output

djc
before I dig into the visual studio docs looking for info on this I decided
to post here to hopefully get pointed in the right direction and maybe save
some some.

I am playing around with creating console programs. I want to create my own
tools and utilities, not full blown applications. However, even my small
tools may have a lot of output. I want to find out how I can format my
output nicely. For example, using nicely aligned columns.

The only thing that came to mind was just queuing all my output into one
string and adding tabs, spaces, etc... as I build the string and then just
make one call to console.writeline.

However, before I did that I wanted to check the huge collection of tools
available via the .net framework (1.1 and/or 2.0) to see what more
specialized classes may exist for this. Do any? Or do I just focus on the
string manipulating classes and do what I mentioned previously?

any input is appreciated. Thanks.
Apr 4 '06 #1
2 2833

"djc" <no***@nowhere.com> wrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
before I dig into the visual studio docs looking for info on this I
decided to post here to hopefully get pointed in the right direction and
maybe save some some.

I am playing around with creating console programs. I want to create my
own tools and utilities, not full blown applications. However, even my
small tools may have a lot of output. I want to find out how I can format
my output nicely. For example, using nicely aligned columns.

The only thing that came to mind was just queuing all my output into one
string and adding tabs, spaces, etc... as I build the string and then just
make one call to console.writeline.

However, before I did that I wanted to check the huge collection of tools
available via the .net framework (1.1 and/or 2.0) to see what more
specialized classes may exist for this. Do any? Or do I just focus on the
string manipulating classes and do what I mentioned previously?

any input is appreciated. Thanks.


Take a look at Console.WriteLine overloads. Ex:

Console.WriteLine("Blah : {0,-30} Testing: {1}", "boo", "bee");

HTH :)

Mythran

Apr 4 '06 #2
djc
will do. Thanks.

"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...

"djc" <no***@nowhere.com> wrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
before I dig into the visual studio docs looking for info on this I
decided to post here to hopefully get pointed in the right direction and
maybe save some some.

I am playing around with creating console programs. I want to create my
own tools and utilities, not full blown applications. However, even my
small tools may have a lot of output. I want to find out how I can format
my output nicely. For example, using nicely aligned columns.

The only thing that came to mind was just queuing all my output into one
string and adding tabs, spaces, etc... as I build the string and then
just make one call to console.writeline.

However, before I did that I wanted to check the huge collection of tools
available via the .net framework (1.1 and/or 2.0) to see what more
specialized classes may exist for this. Do any? Or do I just focus on the
string manipulating classes and do what I mentioned previously?

any input is appreciated. Thanks.


Take a look at Console.WriteLine overloads. Ex:

Console.WriteLine("Blah : {0,-30} Testing: {1}", "boo", "bee");

HTH :)

Mythran

Apr 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
11
by: Steven T. Hatton | last post by:
OK, I take back the nasty stuff I said about printf. At least until I see a similarly concise way of writing this using C++ formatters. I want to convert the following to something I can put onto...
7
by: shawnk | last post by:
Hello Everyone How do you format format numbers right-justified using Console.WriteLine(), i.e I need to line up numbers in vertical columns and the MSDN documentation is pretty poor Here is the...
4
by: John Sutor | last post by:
I need some code that, on each keyup event, will take all of the numbers typed into the text box and format as they type to look like this 100 1,000 10,000 100,000 1,000,000 John S
2
by: Homer Simpson | last post by:
Hi, I'm looking for a way to format the output of my double value. For example, the result of a calculation may be 12.3456789 but I want to display 12.346 (three decimal places of precision)....
14
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my...
9
by: john coltrane | last post by:
Is there way to create a formatted string in a similar that is similar to sprintf? The same for printing, printf? C,D,E,F,G,N,X for currency, decimal, exponential, fixed, general, numerical,...
13
by: cj2 | last post by:
pages = 1 pages.tostring gives me "1" pages+1.tostring gives me "2.0" Why did it add the ".0" on there? I was looking for "2" and this screws me up. Actually this is what I was doing. In...
5
by: thedsadude | last post by:
Hello, I'm launching a script as follows: <code> p = subprocess.Popen() p.wait() </code> If p.py writes to sys.stdout, then it is shown on the console.
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.