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