Package org.javalite.common
Class TablePrinter
java.lang.Object
org.javalite.common.TablePrinter
Prints a two dimensional array to STDIO as a formatted table. Width of columns will be automatically adjusted based on data.
stolen... ehhr borrowed from:
Printing to CONSOLE in TABLE format.
Usage:
String[][] table = new String[][] { { "id", "First Name", "Last Name", "Age" }, { "1", "John", "Johnson", "45" }, { "2", "Tom", "", "35" }, { "3", "Rose", "Johnson", "23"}, { "4", "Jimmy", "Kimmel", "" } }; TablePrinter.printTable(table);The above will result in this output:
+----+------------+-----------+-----+ | id | First Name | Last Name | Age | +----+------------+-----------+-----+ | 1 | John | Johnson | 45 | | 2 | Tom | | 35 | | 3 | Rose | Johnson | 23 | | 4 | Jimmy | Kimmel | | +----+------------+-----------+-----+This code was
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
static void
printTable(String[][] table)
Expects a two-dimensional array of strings.
-
Constructor Details
-
TablePrinter
public TablePrinter()
-
-
Method Details
-
main
-
printTable
Expects a two-dimensional array of strings. Does not tolerate null values. ALl cells must be String instances.
-