module Cythara
Overview
A small collection of String helpers
Defined in:
cythara/ansi.crcythara/version.cr
cythara/wrap.cr
Class Method Summary
-
.contains_ansi?(string) : Bool
Returns true if
string
contains ANSI escape codes. -
.linewrap(string : String, width : Int32, strip_leading_space = true) : Array(String)
Returns a line-wrapped representation of
string
. -
.strip_ansi(string) : String
Returns
string
with all ANSI escape codes removed. -
.wordwrap(string : String, width : Int32, separators = [' ', '\n'], breakers = ['-']) : Array(String)
Returns a word-wrapped representation of
string
.
Class Method Detail
Returns a line-wrapped representation of string
.
Examples:
Cythara.linewrap("The quick brown fox", 6) => ["The qu", "ick br", "own fo", "x"]
Cythara.linewrap("The quick brown fox", 15) => ["The quick brown", "fox"]
Cythara.linewrap("The quick brown fox", 15, false) => ["The quick brown", " fox"]