Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stringbean/text-utils
Simple Text Utils for Scala
https://github.com/stringbean/text-utils
scala text text-generators
Last synced: about 2 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 (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T10:31:12.000Z (3 months ago)
- Last Synced: 2024-10-21T15:16:36.452Z (3 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
[![Build Status](https://img.shields.io/github/actions/workflow/status/stringbean/text-utils/ci.yml)](https://github.com/stringbean/text-utils/actions/workflows/ci.yml)
[![Codacy Grade](https://img.shields.io/codacy/grade/7b07263adca449ee8e51133b87af5030.svg?label=codacy)](https://www.codacy.com/app/stringbean/text-utils)
[![Maven Central - Scala 2.12](https://img.shields.io/maven-central/v/software.purpledragon/text-utils_2.12.svg?label=scala%202.12)](https://search.maven.org/search?q=g:software.purpledragon%20a:text-utils_2.12)
[![Maven Central - Scala 2.13](https://img.shields.io/maven-central/v/software.purpledragon/text-utils_2.13.svg?label=scala%202.13)](https://search.maven.org/search?q=g:software.purpledragon%20a:text-utils_2.13)
[![Maven Central - Scala 3](https://img.shields.io/maven-central/v/software.purpledragon/text-utils_3.svg?label=scala%203)](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).