Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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.

Wish-list: 

  • 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
  • No labels