Function

setTextAndPlaceCursorAtEnd

Sets the text in this TextFieldState to text, replacing any text that was previously there, and places the cursor at the end of the new text.

setTextAndPlaceCursorAtEnd

Source set: Common
public fun TextFieldState.setTextAndPlaceCursorAtEnd(text: String)

Sets the text in this TextFieldState to text, replacing any text that was previously there, and places the cursor at the end of the new text.

To perform more complicated edits on the text, call TextFieldState.edit. This function is equivalent to calling:

edit {
replace(0, length, text)
placeCursorAtEnd()
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: