# Sandbox.UI.Label.ReplaceSelection

```csharp
void ReplaceSelection(string str)
```

Replace the currently selected text with given text, or insert it at the caret when
nothing is selected. The caret ends up after the replacement.

### Parameters

- `str` (`string`)

Declared in [Sandbox.UI.Label](/api/Sandbox.UI.Label).
Assembly: `Sandbox.Engine`.
