tabulate

Tabulate array of array data.

Parameters

data T[][]

An array of array of string compatible data

headers string[]

Headers for each columns

config Config

A configuration to set appearance

Return Value

Type: string

The table string

Examples

const testdata = [
    ["D-man", "Programming Language"],
    ["D言語くん", "プログラミング言語"],
];
const headers = ["マスコットキャラクタ", "about"];
const reference =
    " マスコットキャラクタ          about         \n" ~
    "---------------------- ----------------------\n" ~
    "        D-man           Programming Language \n" ~
    "      D言語くん          プログラミング言語  ";
assert(tabulate(testdata, headers, Config(Style.simple, Align.center, true)) == reference);

Meta