Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Shivamdhuria
Last active November 19, 2020 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shivamdhuria/7198e2bc00afe0cdbd74e47076fe52a3 to your computer and use it in GitHub Desktop.
Save Shivamdhuria/7198e2bc00afe0cdbd74e47076fe52a3 to your computer and use it in GitHub Desktop.
val isSubmitEnabled: Flow<Boolean> = combine(_firstName, _password, _userID) { firstName, password, userId ->
val regexString = "[a-zA-Z]+"
val isNameCorrect = firstName.matches(regexString.toRegex())
val isPasswordCorrect = password.length > 8
val isUserIdCorrect = userId.contains("_")
return@combine isNameCorrect and isPasswordCorrect and isUserIdCorrect
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment