-1

I have a scenario, where I need to restrict the user to enter leading, trailing and consecutive space and if the user enters do not update the text with space but show the error message.

Its like not updating the text itself when user enters any of the leading, trailing or consecutive spaces.

How can we do that in kotlin?

Dishita Shah
  • 21
  • 1
  • 6

1 Answers1

-1

If you don't want leading and trailing blanks you can use trim()

eg: editText.text.trim.toString.trim()