table

Formats multiple arrays into columns.

Syntax

table(array_1 [, array_2,..., array_n], format, from, to)

Input

array_1
An array of values for column 1.
array_2
An optional array of values for column 2.
array_n
An optional array of values for column n.
format
A format descriptor for each column in the table.
from
The index of the first element in each column.
to
The index of the last element in each column.

Example

Example 1
Template:
{label = {"zero", "one", "two", "three", "four"} }
{c0 = {" ", "I", "II", "III", "IV", "V", "VI"} }
{c1 = {0, 1, 2, 3, 4, 5, 6} }
{table(label, c0, c1, "%8s %8s %4d", 0, 3)}
Output:
zero 0
one I 1
two II 2
three III 3
Example 2
Template:
{label = {"zero", "one", "two", "three", "four"} }
{c0 = {" ", "I", "II", "III", "IV", "V", "VI"} }
{c1 = {0, 1, 2, 3, 4, 5, 6} }
{table(label, c0, c1, "%8s %8s %4d", 0, 4)}
Output:
zero 0
one I 1
two II 2
three III 3
four IV 4
Example 3
Template:
{label = {"zero", "one", "two", "three", "four"} }
{c0 = {" ", "I", "II", "III", "IV", "V", "VI"} }
{c1 = {0, 1, 2, 3, 4, 5, 6} }
{table(label, c0, c1, "%8s %8s %4d", 1, 6)}
Output:
one I 1
two II 2
three III 3
four IV 4
V 5
VI 6

Comments

Each array represents a column of data in the table. Every array requires a corresponding C-style format descriptor in the format string.

The range of values to be displayed in the columns is specified by from and to. If more elements are available than indicated by from and to, the extra elements are ignored (as shown in the first example). Array indexing starts at 0.

If there are fewer elements available than indicated by from and to, blanks are substituted (as shown in the third example).