Skip to content

Instantly share code, notes, and snippets.

@manoj-mili
Created November 8, 2021 18:33
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 manoj-mili/3db3764edbd3b4547bfbeee939a70c41 to your computer and use it in GitHub Desktop.
Save manoj-mili/3db3764edbd3b4547bfbeee939a70c41 to your computer and use it in GitHub Desktop.
Code in Function Based on Name
//Don't add validation in this function as the name of the function only suggest to add it to db
fun savePhoneNumber(phoneNumber: String) {
if (!phoneNumber.equals("") && phoneNumber.length == 10 && phoneNumber regex check and etc...) {
dao.saveNumber(phoneNumber)
}
}
//Do only pass numbers post validation
fun savePhoneNumber(phoneNumber: String) {
dao.saveNumber(phoneNumber)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment