---
title: "DeleteSurroundingTextCommand"
description: "Delete [lengthBeforeCursor] characters of text before the current cursor position, and delete
[lengthAfterCursor] characters of text after the current cursor position, excluding the
selection.

Before and after refer to the order of the characters in the string, not to their visual
representation.

See
[`deleteSurroundingText`](https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#deleteSurroundingText(int,%2520int))."
type: "class"
---

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


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

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


```kotlin
class DeleteSurroundingTextCommand(val lengthBeforeCursor: Int, val lengthAfterCursor: Int) :
    EditCommand
```


Delete `lengthBeforeCursor` characters of text before the current cursor position, and delete
`lengthAfterCursor` characters of text after the current cursor position, excluding the
selection.

Before and after refer to the order of the characters in the string, not to their visual
representation.

See
``deleteSurroundingText``(https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#deleteSurroundingText(int,%2520int)).

#### Parameters

| | |
| --- | --- |
| lengthBeforeCursor | The number of characters in UTF-16 before the cursor to be deleted. Must be non-negative. |
| lengthAfterCursor | The number of characters in UTF-16 after the cursor to be deleted. Must be non-negative. |




