I am currently Creating a ASCII table builder which is required for some automated database reports in a GXP environment.
Given that I have table rows with a width of n such as:
| this | is | an | example | row |
|<-- width = 32 -->|
I now want to add headers and spacers such as:
#================================#
| this | is | an | example | row |
|--------------------------------|
| 1 | 2 | 3 | 4 | 5 |
| 3 | 9 | 77 | 327814 | 2 |
|--------------------------------|
of course I could do this in the following way:
List<string> asciiTable = new List<string();
string topBorder = "#";
string otherBorder = "|";
for (int i = 1; i == n; i++)
{
topBorder += "=";
otherBorder += "-";
}
topBorder += "#";
otherBorder += "|";
asciiTable.Add(topBorder);
but I hope there is something such as:
List<string> asciiTable = new List<string>();
asciiTable.Add("#" + /* add("=",n) */ + "#");