mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add console.table
This commit is contained in:
parent
1b4424f7fa
commit
97d48dde0b
@ -102,6 +102,17 @@ public class Console {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------- print
|
||||
|
||||
/**
|
||||
* 打印表格到控制台
|
||||
*
|
||||
* @param consoleTable 控制台表格
|
||||
* @since 5.4.5
|
||||
*/
|
||||
public static void table(ConsoleTable consoleTable) {
|
||||
print(consoleTable.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 同 System.out.print()方法,打印控制台日志
|
||||
*
|
||||
|
@ -35,6 +35,16 @@ public class ConsoleTable {
|
||||
*/
|
||||
private List<Integer> columnCharNumber;
|
||||
|
||||
/**
|
||||
* 创建ConsoleTable对象
|
||||
*
|
||||
* @return ConsoleTable
|
||||
* @since 5.4.5
|
||||
*/
|
||||
public static ConsoleTable create(){
|
||||
return new ConsoleTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加头信息
|
||||
*
|
||||
@ -101,7 +111,7 @@ public class ConsoleTable {
|
||||
/**
|
||||
* 填充表头或者表体信息
|
||||
*
|
||||
* @param sb
|
||||
* @param sb 内容
|
||||
* @param list 表头列表或者表体列表
|
||||
*/
|
||||
private void fillRow(StringBuilder sb, List<List<String>> list) {
|
||||
|
@ -1,12 +1,11 @@
|
||||
package cn.hutool.core.lang;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ConsoleTableTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
// @Ignore
|
||||
public void printTest() {
|
||||
ConsoleTable t = new ConsoleTable();
|
||||
t.addHeader("姓名", "年龄");
|
||||
|
Loading…
x
Reference in New Issue
Block a user