Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simon622/string-table
Java utility to allow quick rendering of tabulated data into various output formats
https://github.com/simon622/string-table
ascii csv database java logging table
Last synced: 28 days ago
JSON representation
Java utility to allow quick rendering of tabulated data into various output formats
- Host: GitHub
- URL: https://github.com/simon622/string-table
- Owner: simon622
- License: apache-2.0
- Created: 2019-12-06T12:03:06.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-30T08:00:07.000Z (almost 5 years ago)
- Last Synced: 2024-11-15T15:49:13.307Z (3 months ago)
- Topics: ascii, csv, database, java, logging, table
- Language: Java
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# String-Table
Lightweight Java framework to allow quick rendering of tabulated data.
Great for debugging and quickly visualising data for logging or reporting.
Supports automatic column size detection, advanced sort, rollup and multiple output formats.## Recent changes
* 2018 - Added support for ResultSet reading into StringTable
* 2019 - Added support for data sorting by Lexical and Numeric types.
* 2019 - Added support for HTML outputInbuilt support for the following export formats;
* ASCII
* CSV
* HTML## Simple example
```java
StringTable st = new StringTable("First Column", "Second Column", "Third Column");
for (int i = 0; i < 10; i++) {
st.addRow(i, i, i);
}
System.out.println(StringTableWriters.writeStringTableAsASCII(st));
```## Database example
```java
ResultSet rs = ...
StringTable st = StringTableDatabaseUtils.readStringTable(rs);
System.out.println(StringTableWriters.writeStringTableAsHTML(st));
```### Export as ASCII
+--------------++---------------++--------------+
| First Column || Second Column || Third Column |
+--------------++---------------++--------------+
| 0 || 0 || 0 |
| 1 || 1 || 1 |
| 2 || 2 || 2 |
| 3 || 3 || 3 |
| 4 || 4 || 4 |
| 5 || 5 || 5 |
| 6 || 6 || 6 |
| 7 || 7 || 7 |
| 8 || 8 || 8 |
| 9 || 9 || 9 |
+--------------++---------------++--------------+### Export as HTML
First ColumnSecond ColumnThird Column000111222333444555666777888999### Export as CSV
First Column,Second Column,Third Column
0,0,0
1,1,1
2,2,2
3,3,3
4,4,4
5,5,5
6,6,6
7,7,7
8,8,8
9,9,9## Sort table
```java
StringTable st = new StringTable("First Column", "Second Column", "Third Column");
for (int i = 0; i < 10; i++) {
st.addRow(i, i, i);
}
st.sort(0, false);
```