change the separator between columns, use null for no separator
change the prefix that is printed in front of each row
change the separator between rows, use null for no separator
Convert to tabular presentation
import unit_threaded; import std.conv; auto table = new AsciiTable(2) .row.add("1").add("2") .row.add("3").add("4") .table; auto f1 = table.format.to!string; f1.shouldEqual("12\n34"); auto f2 = table.format.prefix(" ").rowSeparator("-").to!string; f2.shouldEqual(" --\n 12\n --\n 34\n --"); auto f3 = table.format.prefix(" ").columnSeparator("|").to!string; f3.shouldEqual(" |1|2|\n |3|4|"); auto f4 = table.format.prefix(" ").columnSeparator("|").rowSeparator("-").to!string; f4.shouldEqual(" -----\n |1|2|\n -----\n |3|4|\n -----");
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\ntest:2 \ntest:45\ntest: 6");
import unit_threaded; auto table = new AsciiTable(1) .header.add("1") .row.add(2) .table; auto f1 = table.format.headerSeparator("=").rowSeparator("-").to!string; f1.shouldEqual("-\n1\n=\n2\n-");
the formatter collects format parameters and prints the table