Skip to content

Instantly share code, notes, and snippets.

@braghome
Last active April 21, 2021 00:00
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 braghome/dd2f92e625c7f35ee5d4fd742b09981c to your computer and use it in GitHub Desktop.
Save braghome/dd2f92e625c7f35ee5d4fd742b09981c to your computer and use it in GitHub Desktop.
some missing code on vegeta2102 blog trying to add it back in
private val charList = listOf<Char>('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
val isValidCharacters: (Char) -> Boolean = {c -> charList.contains(Character.toLowerCase(c))}
val isCharNumberUnderScore: (String) -> Boolean = { s: String ->
val allValid = s.all { ch ->
isValidCharacters(ch) || Character.valueOf(ch).isDigit() || Character.valueOf(ch) == '_'
}
allValid
}
class Validator {
fun verify(shoeName: String): Boolean {
return isCharNumberUnderScore(shoeName)
}
}
@braghome
Copy link
Author

braghome commented Apr 20, 2021

@lupajz I recently checked your blog on medium Two-way data binding with InputTextEditText Google Material

strange compilation error on line 13

@braghome
Copy link
Author

braghome commented Apr 20, 2021

aah, the solution was to make every static, AKA in kotlin speak into a companion object used the declared class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment