Str

object Str
Companion:
class
class Object
trait Matchable
class Any
Str.type

Type members

Types

type State = Long

An fansi.Str's colors array is filled with Long, each representing the ANSI state of one character encoded in its bits. Each Attr belongs to a Category that occupies a range of bits within each long:

An fansi.Str's colors array is filled with Long, each representing the ANSI state of one character encoded in its bits. Each Attr belongs to a Category that occupies a range of bits within each long:

61... 55 54 53 52 51 .... 31 30 29 28 27 26 25 ..... 6 5 4 3 2 1 0 |--------| |-----------------------| |-----------------------| | | |bold | | | | |reversed | | | |underlined | | |foreground-color | |background-color |unused

The 0000 0000 0000 0000 long corresponds to plain text with no decoration

Value members

Concrete methods

def Sanitize(raw: CharSequence): Str

Shorthand constructor with ErrorMode.Sanitize

Shorthand constructor with ErrorMode.Sanitize

def Strip(raw: CharSequence): Str

Shorthand constructor with ErrorMode.Strip

Shorthand constructor with ErrorMode.Strip

def Throw(raw: CharSequence): Str

Shorthand constructor with ErrorMode.Throw

Shorthand constructor with ErrorMode.Throw

def apply(raw: CharSequence, errorMode: ErrorMode): Str

Creates an fansi.Str from a non-fansi java.lang.String or other CharSequence.

Creates an fansi.Str from a non-fansi java.lang.String or other CharSequence.

Note that this method is implicit, meaning you can pass in a java.lang.String anywhere an fansi.Str is required and it will be automatically parsed and converted for you.

Value parameters:
errorMode

Used to control what kind of behavior you get if the input CharSequence contains an Ansi escape not recognized by Fansi as a valid color.

def apply(args: Str*): Str
def fromArrays(chars: Array[Char], colors: Array[State]): Str

Constructs a fansi.Str from an array of characters and an array of colors. Performs a defensive copy of the arrays, and validates that they both have the same length

Constructs a fansi.Str from an array of characters and an array of colors. Performs a defensive copy of the arrays, and validates that they both have the same length

Useful together with getChars and getColors if you want to do manual work on the two mutable arrays before stitching them back together into one immutable fansi.Str

def join(args: Iterable[Str], sep: Str): Str

Concrete fields

val ansiRegex: Pattern

Regex that can be used to identify Ansi escape patterns in a string.

Regex that can be used to identify Ansi escape patterns in a string.

Found from: http://stackoverflow.com/a/33925425/871202

Which references:

http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf

Section 5.4: Control Sequences

Implicits

Implicits

implicit def implicitApply(raw: CharSequence): Str

Make the construction of fansi.Strs from Strings and other CharSequences automatic

Make the construction of fansi.Strs from Strings and other CharSequences automatic