Formatting simple tabular text data
This class has been posted first time on the Groovy-User Mailing List by Raffaele Castagno in this format:
and later "groovyfied" by Gavin Grover:
First version is here only as an example of the "groovify process". Of course, the Gavin's version is better.
This class emulate the output of most RDBMS consoles (ie. Oracle SQL*, MySql).
Here's an usage example (again, grooved up by Gavin):
This is the output:
Actually is really limited: column width must be declared, and strings are truncated to that given size.
- Automatic column width based on maximum string length
- Multiline records
- Multiline fields
- More formatting options (alignment, case, etc)
- Management of footer fields (totals, formulae, etc)
- Automatic line-wrap based on screen size