[C#] Can anyone point me in the direction of an ASCII table formatter?

This topic is 2533 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I'm after an ASCII table formatter in a similar vein to this one: http://cxc.harvard.e...dule-asciitable

I'm looking to automatically generate tables using ASCII characters to produce something similar to the following:

 | Column 1 | Column 2 | Column 3 | ===================================== |FM-8 | 1981-05 | M68A09 @ 1MHz | |FM-7 | 1982-11 | M68B09 @ 2MHz | 

The '|' should line up and auto size depending on the number of characters in each cell.

Any ideas?

Thank you.

Share on other sites
Well it should be pretty simple, first establish the correct width of each column by iterating over all data lines, and place the separators | accordingly. Then replace the spaces in between by the proper data texts. The === line can then be inserted easily.

Share on other sites
Good call, I've rolled my own.

Would have liked to seen other examples but I've created one in 79 lines that works well so I'm happy.

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• Forum Statistics

• Total Topics
633744
• Total Posts
3013652
×