Output in a table format in Java's System.out

前端 未结 8 1452
清歌不尽
清歌不尽 2020-11-22 15:03

I\'m getting results from a database and want to output the data as a table in Java\'s standard output

I\'ve tried using \\t but the first column I want is very vari

8条回答
  •  星月不相逢
    2020-11-22 15:54

    Using j-text-utils you may print to console a table like: enter image description here

    And it as simple as:

    TextTable tt = new TextTable(columnNames, data);                                                         
    tt.printTable();   
    

    The API also allows sorting and row numbering ...

提交回复
热议问题