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