Skip to content

Instantly share code, notes, and snippets.

@rnaufal
Last active February 23, 2020 20:35
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 rnaufal/ea6d58f6a609305e3835f2d9cf2fade7 to your computer and use it in GitHub Desktop.
Save rnaufal/ea6d58f6a609305e3835f2d9cf2fade7 to your computer and use it in GitHub Desktop.
final var totalDigits = string.chars()
.filter(Character::isDigit)
.count();
final var totalUppercaseChars = string.chars()
.filter(Character::isUpperCase)
.count();
final var totalLowercaseChars = string.chars()
.filter(Character::isLowerCase)
.count();
final var totalInvalidChars = string.chars()
.filter(character -> !Character.isLetterOrDigit(character))
.count();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment