Class

TextRange

An immutable text range class, represents a text range from start (inclusive) to end (exclusive).

Source set: Common
value class TextRange internal constructor(private val packedValue: Long)

An immutable text range class, represents a text range from start (inclusive) to end (exclusive). end can be smaller than start and in those cases min and max can be used in order to fetch the values.

Properties

start

Source set: Common
val start: Int

end

Source set: Common
val end: Int

min

Source set: Common
val min: Int

The minimum offset of the range.

max

Source set: Common
val max: Int

The maximum offset of the range.

collapsed

Source set: Common
val collapsed: Boolean

Returns true if the range is collapsed

reversed

Source set: Common
val reversed: Boolean

Returns true if the start offset is larger than the end offset.

length

Source set: Common
val length: Int

Returns the length of the range.

Functions

intersects

fun intersects(other: TextRange): Boolean

Returns true if the given range has intersection with this range

contains

operator fun contains(other: TextRange): Boolean

Returns true if this range covers including equals with the given range.

contains

operator fun contains(offset: Int): Boolean

Returns true if the given offset is a part of this range.

Companion Object

Properties

Source set: Common
val Zero = TextRange(0)

Last updated: