src/Tables/GridTable.cs
/// <summary>
/// Renders a row separator for the grid table.
/// </summary>
/// <param name="sb">StringBuilder to add to.</param>
/// <param name="widths">Column widths</param>
/// <param name="sep">Separator between columns</param>
/// <param name="includeAlignment">True to include alignment characters.</param>
Renders a row separator for the grid table.
Renders a row separator for the grid table .
private void RenderRowSeparator(StringBuilder sb, int[] widths, char sep, bool includeAlignment)
        {
            for (var index = 0; index < ColumnAlignments.Length; index++)
            {
                sb.Append('+');
                if (includeAlignment)
                {
                    var alignment = ColumnAlignments[index];
                    switch (alignment)
                    {
                        case ColumnAlignment.Center:
                            sb.Append(':').Append(new string(sep, widths[index]-2)).Append(':');
                            break;
                        case ColumnAlignment.Right:
                            sb.Append(new string(sep, widths[index]-1)).Append(':');
                            break;
                        default: 
                            sb.Append(new string(sep, widths[index]));
                            break;
                    }
                }
                else
                {
                    sb.Append(new string(sep, widths[index]));
                }
            }
            sb.AppendLine("+");
        }
private void RenderRowSeparator ( StringBuilder sb , int [ ] widths , char sep , bool includeAlignment ) { for ( var index = 0 ; index < ColumnAlignments . Length ; index ++ ) { sb . Append ( ' ' ) ; if ( includeAlignment ) { var alignment = ColumnAlignments [ index ] ; switch ( alignment ) { case ColumnAlignment . Center : sb . Append ( ' ' ) . Append ( new string ( sep , widths [ index ] - 2 ) ) . Append ( ' ' ) ; break ; case ColumnAlignment . Right : sb . Append ( new string ( sep , widths [ index ] - 1 ) ) . Append ( ' ' ) ; break ; default : sb . Append ( new string ( sep , widths [ index ] ) ) ; break ; } } else { sb . Append ( new string ( sep , widths [ index ] ) ) ; } } sb . AppendLine ( " " ) ; }
Renders a row separator for the grid table.
Renders a row separator for the grid table .
// Left
sb
StringBuilder
StringBuilder to add to.
StringBuilder to add to .
widths
int[]
None
sep
char
Separator between columns
Separator between columns
includeAlignment
bool
True to include alignment characters.
True to include alignment characters .