- borders
auto borders(bool borders)
Undocumented in source. Be warned that the author may not have intended to support it.
- bottomBorder
auto bottomBorder(bool bottomBorder)
Undocumented in source. Be warned that the author may not have intended to support it.
- calcHorizontalSeparator
string calcHorizontalSeparator(string normal, string left, string middle, string right)
Undocumented in source. Be warned that the author may not have intended to support it.
- columnSeparator
auto columnSeparator(bool columnSeparator)
change the separator between columns, use null for no separator
- columnWidths
auto columnWidths(ulong[] widths)
Undocumented in source. Be warned that the author may not have intended to support it.
- headerSeparator
auto headerSeparator(bool headerSeparator)
Undocumented in source. Be warned that the author may not have intended to support it.
- horizontalBorders
auto horizontalBorders(bool borders)
Switch top and bottom border
- leftBorder
auto leftBorder(bool leftBorder)
Undocumented in source. Be warned that the author may not have intended to support it.
- parts
auto parts(Parts parts)
Undocumented in source. Be warned that the author may not have intended to support it.
- prefix
auto prefix(string newPrefix)
change the prefix that is printed in front of each row
- rightBorder
auto rightBorder(bool rightBorder)
Undocumented in source. Be warned that the author may not have intended to support it.
- rowSeparator
auto rowSeparator(bool rowSeparator)
change the separator between rows, use null for no separator
- separators
auto separators(bool active)
Undocumented in source. Be warned that the author may not have intended to support it.
- toString
string toString()
Convert to tabular presentation
- topBorder
auto topBorder(bool topBorder)
Undocumented in source. Be warned that the author may not have intended to support it.
- verticalBorders
auto verticalBorders(bool borders)
Switch left and right border
import unit_threaded;
import std.conv;
// dfmt off
auto table = new AsciiTable(2)
.header.add("HA").add("HB")
.row.add("C").add("D")
.row.add("E").add("F")
.table;
auto f1 = table
.format
.parts(new UnicodeParts)
.borders(true)
.separators(true)
.to!string;
// dfmt on
std.stdio.writeln(f1);
f1.shouldEqual(`┌──┬──┐
│HA│HB│
╞══╪══╡
│C │D │
├──┼──┤
│E │F │
└──┴──┘`);
// dfmt off
auto f2 = table
.format
.parts(new UnicodeParts)
.prefix(" ")
.rowSeparator(true)
.to!string;
// dfmt on
f2.shouldEqual(` HAHB
─────
C D
─────
E F `);
// dfmt off
auto f3 = table
.format
.parts(new UnicodeParts)
.columnSeparator(true)
.to!string;
// dfmt on
f3.shouldEqual(`HA│HB
C │D
E │F `);
import unit_threaded;
auto table = new AsciiTable(2).row.add("1\n2").add("3").row.add("4").add("5\n6").table;
auto f = table.format.prefix("test:").to!string;
f.shouldEqual(`test:13
test:2
test:45
test: 6`);
import unit_threaded;
auto table = new AsciiTable(1).header.add("1").row.add(2).table;
auto f1 = table.format.headerSeparator(true).rowSeparator(true)
.topBorder(true).bottomBorder(true).to!string;
f1.shouldEqual(`-
1
=
2
-`);
the formatter collects format parameters and prints the table