A lightweight, zero-dependency Java ASCII TABLE generation library.
- Lightweight, no dependencies (jar package only
9kb
) - API is easy to use
- Easy to integrate or customize modifications, only one Java file, and code specification
<dependency>
<groupId>com.blinkfox</groupId>
<artifactId>mini-table</artifactId>
<version>1.0.0</version>
</dependency>
String table = new MiniTable()
.addHeaders("header1", "header2")
.addDatas("col11", "col12")
.addDatas("col21", "col22")
.render();
System.out.println(table);
Output Result:
+---------+---------+
| header1 | header2 |
+---------+---------+
| col11 | col12 |
| col21 | col22 |
+---------+---------+
String table = new MiniTable("The Title")
.addHeaders("Name", "Sex", "Age", "Email", "Phone")
.addDatas("LiLei", "male", 25, "[email protected]", "13809345219")
.addDatas("hanMeiMei", "female", 23, "[email protected]", "13515343853")
.addDatas("ZhangSan", "female", 32, "[email protected]", "13920199836")
.render();
System.out.println(table);
Output Result:
+-------------------------------------------------------------+
| The Title |
+-----------+--------+-----+--------------------+-------------+
| Name | Sex | Age | Email | Phone |
+-----------+--------+-----+--------------------+-------------+
| LiLei | male | 25 | [email protected] | 13809345219 |
| hanMeiMei | female | 23 | [email protected] | 13515343853 |
| ZhangSan | female | 32 | [email protected] | 13920199836 |
+-----------+--------+-----+--------------------+-------------+
This mini-table library is open sourced under the Apache License 2.0.