Created
January 17, 2020 21:51
-
-
Save rnaufal/69202d997e61dea7fead4d23a1ad299c 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
var totalDigits = 0; | |
var totalUppercaseChars = 0; | |
var totalLowercaseChars = 0; | |
var totalInvalidChars = 0; | |
for (final char current : string.toCharArray()) { | |
if (Character.isDigit(current)) { | |
totalDigits += 1; | |
} else if (Character.isUpperCase(current)) { | |
totalUppercaseChars += 1; | |
} else if (Character.isLowerCase(current)) { | |
totalLowercaseChars += 1; | |
} else { | |
totalInvalidChars += 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment