<div class='type'>Function</div>


<a id='references'></a>


<h2 id="textrange-start-end">TextRange</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun TextRange(/*@IntRange(from = 0)*/ start: Int, /*@IntRange(from = 0)*/ end: Int) =
    TextRange(packWithCheck(start, end))
```


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.

#### Parameters

| | |
| --- | --- |
| start | the inclusive start offset of the range. Must be non-negative, otherwise an exception will be thrown. |
| end | the exclusive end offset of the range. Must be non-negative, otherwise an exception will be thrown. |






<hr class="docs-overload-divider">


<h2 id="textrange-index">TextRange</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun TextRange(index: Int): TextRange
```


Creates a `TextRange` where start is equal to end, and the value of those are `index`.