Jump to content
  • Advertisement
Sign in to follow this  
Spa8nky

[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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!