Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private fun isNameValid() : String {
- val name = nameEditText.text
- if (!name.isNameValid()) {
- nameEditText.setError(AppResources.getString(R.string.error))
- nameEditText.requestFocus()
- return ""
- } else {
- nameEditText.setValid()
- return name
- }
- }
- fun String.isNameValid(): Boolean = !this.isBlank() && this.length > 1 && matches("""p{L}+""".toRegex())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement