8000 GitHub - alejandrohdezma/string-box: Simple utility to create nice boxed strings
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Simple utility to create nice boxed strings

License

Notifications You must be signed in to change notification settings

alejandrohdezma/string-box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple utility to create nice boxed strings

Installation

Add the following line to your build.sbt file:

libraryDependencies += "com.alejandrohdezma" %% "string-box" % "1.0.0"

Usage

Add the following import to unblock the syntax:

import com.alejandrohdezma.string.box._

And then use .boxed method on any String value you want to get wrapped in a box:

"\n" + "Hello,\nworld!".boxed
// res0: String = """
// ┌────────┐
// │ Hello, │
// │ world! │
// └────────┘"""
"\n" + "Hello,\nworld!\nI'm a very long string that should be wrapped in a box".boxed
// res1: String = """
// ┌─────────────────────────────────────
6F71
───────────────────┐
// │ 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
alejandrohdezma

About

Simple utility to create nice boxed strings

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Contributors 3

  •  
  •  
  •  

Languages

0