---
title: "insert"
description: "Insert [text] at the given [index] in this value. Pass 0 to insert [text] at the beginning of
this buffer, and pass [TextFieldBuffer.length] to insert [text] at the end of this buffer.

This is equivalent to calling `replace(index, index, text)`."
type: "function"
---

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


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun TextFieldBuffer.insert(index: Int, text: String)
```


Insert `text` at the given `index` in this value. Pass 0 to insert `text` at the beginning of
this buffer, and pass `TextFieldBuffer.length` to insert `text` at the end of this buffer.

This is equivalent to calling `replace(index, index, text)`.

#### Parameters

| | |
| --- | --- |
| index | The character offset at which to insert `text`. |
| text | The text to insert. |




