Version Matrix

Build Status Codacy Grade Test Coverage Maven Central - Scala 2.11 Maven Central - Scala 2.12 Maven Central - Scala 2.13

Simple Text Utils for Scala

text-utils is a collection of useful utilities for formatting text.

Quickstart

Add the following to your build.sbt:

libraryDependencies += "software.purpledragon" %% "text-utils" % "<version>"

Table Formatting

TableFormatter and SortedTableFormatter provide mechanisms for building and printing tabular data.

The simplest case is outputting a bare table without headers:

TableFormatter()
  .addRow("Apples", "25")
  .addRow("Pears", "10")
  .addRow("Bananas", "4")
  .print()

Will output:

Apples   25
Pears    10
Bananas  4

Tables can also be sorted and have a header:

SortedTableFormatter("Produce", "Remaining")
  .addRow("Apples", "25")
  .addRow("Pears", "10")
  .addRow("Bananas", "4")
  .print()

Will output:

| Produce | Remaining |
-----------------------
| Apples  | 25        |
| Bananas | 4         |
| Pears   | 10        |

Full details can be found in the documentation.