case class Str extends Product with Serializable
Encapsulates a string with associated ANSI colors and text decorations.
This is your primary data-type when you are dealing with colored fansi strings.
Contains some basic string methods, as well as some ansi methods to e.g. apply particular colors
or other decorations to particular sections of the fansi.Str. render flattens it out
into a java.lang.String
with all the colors present as ANSI escapes.
Avoids using Scala collections operations in favor of util.Arrays, giving 20% (on ++
) to
>1000% (on splitAt
, subString
and Str.parse
) speedups
- Alphabetic
- By Inheritance
- Str
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def ++(other: Str): Str
Concatenates two fansi.Strs, preserving the colors in each one and avoiding any interference between them
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(other: Any): Boolean
- Definition Classes
- Str → Equals → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def getChar(i: Int): Char
Retrieve the character of this string at the given character index
- def getChars: Array[Char]
Returns a copy of the character array backing this
fansi.Str
, in case you want to use it to - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getColor(i: Int): State
Retrieve the color of this string at the given character index
- def getColors: Array[State]
Returns a copy of the colors array backing this
fansi.Str
, in case you want to use it to - def hashCode(): Int
- Definition Classes
- Str → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def length: Int
The plain-text length of this fansi.Str, in UTF-16 characters (same as
.length
on ajava.lang.String
).The plain-text length of this fansi.Str, in UTF-16 characters (same as
.length
on ajava.lang.String
). If you want fancy UTF-8 lengths, use.plainText
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def overlay(attrs: Attrs, start: Int = 0, end: Int = length): Str
Overlays the desired color over the specified range of the fansi.Str.
- def overlayAll(overlays: Seq[(Attrs, Int, Int)]): Str
Batch version of overlay, letting you apply a bunch of Attrs onto various parts of the same string in one operation, avoiding the unnecessary copying that would happen if you applied them with overlay one by one.
- lazy val plainText: String
The plain-text
java.lang.String
represented by this fansi.Str, without all the fansi colors or other decorations - def productElementNames: Iterator[String]
- Definition Classes
- Product
- def render: String
Converts this fansi.Str into a
java.lang.String
, including all the fancy fansi colors or decorations as fansi escapes embedded within the string.Converts this fansi.Str into a
java.lang.String
, including all the fancy fansi colors or decorations as fansi escapes embedded within the string. "Terminates" colors at the right-most end of the resultantjava.lang.String
, making it safe to concat-with or embed-inside otherjava.lang.String
without worrying about fansi colors leaking out of it. - def splitAt(index: Int): (Str, Str)
Splits an fansi.Str into two sub-strings, preserving the colors in each one.
- def substring(start: Int = 0, end: Int = length): Str
Returns an fansi.Str which is a substring of this string, and has the same colors as the original section of this string did
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- Str → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()