一个极简的 Java ASCII 表格生成库


一个轻量级、零依赖的 Java ASCII 表格生成库。

特性

  • 轻量级、无依赖(jar包仅9kb
  • API简单易用
  • 易于集成或定制修改,仅一个Java文件,且代码规范

集成使用

Maven集成

<dependency>
    <groupId>com.blinkfox</groupId>
    <artifactId>mini-table</artifactId>
    <version>1.0.0</version>
</dependency>

API 使用

示例1(无标题)

String table = new MiniTable()
        .addHeaders("header1", "header2")
        .addDatas("col11", "col12")
        .addDatas("col21", "col22")
        .render();
System.out.println(table);

输出结果:

+---------+---------+
| header1 | header2 |
+---------+---------+
|  col11  |  col12  |
|  col21  |  col22  |
+---------+---------+

示例2(有标题)

String table = new MiniTable("The Title")
        .addHeaders("Name", "Sex", "Age", "Email", "Phone")
        .addDatas("LiLei", "male", 25, "[email protected]om", "13809345219")
        .addDatas("hanMeiMei", "female", 23, "[email protected]", "13515343853")
        .addDatas("ZhangSan", "female", 32, "[email protected]", "13920199836")
        .render();
System.out.println(table);

输出结果:

+-------------------------------------------------------------+
|                          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 |
+-----------+--------+-----+--------------------+-------------+

许可证

mini-table 类库遵守 Apache License 2.0 许可证。


 上一篇
Java代码性能评估库Stalker介绍 Java代码性能评估库Stalker介绍
English Document 这是一个简单的用来对Java代码做性能评估的工具库。 特性 轻量级(jar包仅26kb) API简单易用 易于集成或扩展 Maven集成<dependency> <groupId>
2019-02-14
下一篇 
flutter 开发教程 flutter 开发教程
常见问题Flutter:New ProjectWaiting for another flutter command to release the startup lock…解决办法:删除./flutter/bin/cache/lockfi
2019-01-10
  目录