I am outputting a columnar table to a text file, 5 columns each 20 characters wide.
The example below lets me align these columns either left or right.
I have several long winded ways of creating the title line above these that involve calculating the length of each string, but is there a simple way to 'center align', with each of the 5 title headings centered above the 20 chr wide columns? On a one time deal I can easily just build a string that fits.
The example below lets me align these columns either left or right.
VB.NET:
Dim strfmt As String = "{0,-20}{1,-20}{2,-20}{3,-20}{4,-20}"
Dim strfmt As String = "{0,20}{1,20}{2,20}{3,20}{4,20}"
"Payment Date Amount Paid Principal Paid Interest Paid Principal Balance"
I have several long winded ways of creating the title line above these that involve calculating the length of each string, but is there a simple way to 'center align', with each of the 5 title headings centered above the 20 chr wide columns? On a one time deal I can easily just build a string that fits.