TextSpan

com.alecdorrington.annotatedtextformat.TextSpan
See theTextSpan companion object
final case class TextSpan(start: Int, end: Int)

A part of a text, from its start up to but excluding its end, counted in UTF-16 code units, as JavaScript's strings count them. Where they are equal, it is a point between two characters, as where text is to be inserted.

Value parameters

end

Where it ends: how many UTF-16 code units of the text come before its end.

start

Where it begins: how many UTF-16 code units of the text come before it.

Attributes

Note

The JVM's strings and the DOM's ranges count alike.

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def contains(at: Int): Boolean

Whether the character at lies within it.

Whether the character at lies within it.

Attributes

def covers(other: TextSpan): Boolean

Whether other lies within it, as a point at either of its ends does.

Whether other lies within it, as a point at either of its ends does.

Attributes

def distance(other: TextSpan): Int

How many characters lie between it and other.

How many characters lie between it and other.

Attributes

def fits(length: Int): Boolean

Whether it lies within a text of length characters, the right way round.

Whether it lies within a text of length characters, the right way round.

Attributes

def in(text: String): String

Its part of text.

Its part of text.

Attributes

def isPoint: Boolean

Whether it is a point, holding no characters.

Whether it is a point, holding no characters.

Attributes

def length: Int

The number of characters within it.

The number of characters within it.

Attributes

def overlaps(other: TextSpan): Boolean

Whether it shares a character with other, which a point never does.

Whether it shares a character with other, which a point never does.

Attributes

def shift(by: Int): TextSpan

It, moved by characters on.

It, moved by characters on.

Attributes

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product