replaceSelection

fun replaceSelection(replacement: String)

Replaces the text between anchorPosition and caretPosition with replacement text. The caret is advanced to the end of the replaced text.