https://github.com/alejandrohdezma/string-box
Simple utility to create nice boxed strings
https://github.com/alejandrohdezma/string-box
Last synced: 3 months ago
JSON representation
Simple utility to create nice boxed strings
- Host: GitHub
- URL: https://github.com/alejandrohdezma/string-box
- Owner: alejandrohdezma
- License: apache-2.0
- Created: 2024-09-26T09:59:03.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-02-15T05:17:15.000Z (4 months ago)
- Last Synced: 2025-02-15T06:26:04.530Z (4 months ago)
- Language: Scala
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
Simple utility to create nice boxed strings
## Installation
Add the following line to your build.sbt file:
```sbt
libraryDependencies += "com.alejandrohdezma" %% "string-box" % "1.0.0"
```## Usage
Add the following import to unblock the syntax:
```scala
import com.alejandrohdezma.string.box._
```And then use `.boxed` method on any `String` value you want to get wrapped in a box:
```scala
"\n" + "Hello,\nworld!".boxed
// res0: String = """
// ┌────────┐
// │ Hello, │
// │ world! │
// └────────┘"""
``````scala
"\n" + "Hello,\nworld!\nI'm a very long string that should be wrapped in a box".boxed
// res1: String = """
// ┌────────────────────────────────────────────────────────┐
// │ Hello, │
// │ world! │
// │ I'm a very long string that should be wrapped in a box │
// └────────────────────────────────────────────────────────┘"""
````boxed` takes ANSI colors (from `scala.io.AnsiColor`) into account, so they're not counted when calculating the width of the box.
## Contributors to this project
|
|
| :--: |
| alejandrohdezma |