Created
August 22, 2021 13:18
-
-
Save Skyyo/028795ad56cebc69005e20d46a0bd53a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object InputValidator { | |
fun getNameErrorIdOrNull(input: String): Int? { | |
return when { | |
input.length < 2 -> R.string.name_too_short | |
//ideally provide different error messages for different errors | |
else -> null | |
} | |
} | |
fun getCardNumberErrorIdOrNull(input: String): Int? { | |
return when { | |
input.length < 16 -> R.string.card_number_too_short | |
//ideally provide different error messages for different errors | |
else -> null | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment