Source set: Common
public 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
public val start: Int
end
Source set: Common
public val end: Int
min
Source set: Common
public val min: Int
The minimum offset of the range.
max
Source set: Common
public val max: Int
The maximum offset of the range.
collapsed
Source set: Common
public val collapsed: Boolean
Returns true if the range is collapsed
reversed
Source set: Common
public val reversed: Boolean
Returns true if the start offset is larger than the end offset.
length
Source set: Common
public val length: Int
Returns the length of the range.
Functions
intersects
Source set: Common
public fun intersects(other: TextRange): Boolean
Returns true if the given range has intersection with this range
contains
Source set: Common
public operator fun contains(other: TextRange): Boolean
Returns true if this range covers including equals with the given range.
contains
Source set: Common
public operator fun contains(offset: Int): Boolean
Returns true if the given offset is a part of this range.
Members
Companion
Source set: Common
public companion object
Properties
Zero
Source set: Common
public val Zero: TextRange = TextRange(0)