https://github.com/stringbean/text-utils
Simple Text Utils for Scala
https://github.com/stringbean/text-utils
scala text text-generators
Last synced: 4 months ago
JSON representation
Simple Text Utils for Scala
- Host: GitHub
- URL: https://github.com/stringbean/text-utils
- Owner: stringbean
- License: apache-2.0
- Created: 2020-02-06T13:56:55.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T10:31:12.000Z (9 months ago)
- Last Synced: 2025-01-10T05:16:33.392Z (6 months ago)
- Topics: scala, text, text-generators
- Language: Scala
- Homepage: https://stringbean.github.io/text-utils
- Size: 1.11 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://github.com/stringbean/text-utils/actions/workflows/ci.yml)
[](https://www.codacy.com/app/stringbean/text-utils)
[](https://search.maven.org/search?q=g:software.purpledragon%20a:text-utils_2.12)
[](https://search.maven.org/search?q=g:software.purpledragon%20a:text-utils_2.13)
[](https://search.maven.org/search?q=g:software.purpledragon%20a:text-utils_3)# Simple Text Utils for Scala
`text-utils` is a collection of useful utilities for formatting text.
## Quickstart
Add the following to your `build.sbt`:
```scala
libraryDependencies += "software.purpledragon" %% "text-utils" % ""
```## Table Formatting
`TableFormatter` and `SortedTableFormatter` provide mechanisms for building and printing tabular data.
The simplest case is outputting a bare table without headers:
```scala
TableFormatter()
.addRow("Apples", "25")
.addRow("Pears", "10")
.addRow("Bananas", "4")
.print()
```Will output:
```text
Apples 25
Pears 10
Bananas 4
```Tables can also be sorted and have a header:
```scala
SortedTableFormatter("Produce", "Remaining")
.addRow("Apples", "25")
.addRow("Pears", "10")
.addRow("Bananas", "4")
.print()
```Will output:
```text
| Produce | Remaining |
-----------------------
| Apples | 25 |
| Bananas | 4 |
| Pears | 10 |
```Full details can be found in the [documentation](https://stringbean.github.io/text-utils/tables.html).