Java
- 2 ответа
- 0 вопросов
0
Вклад в тег
Pattern patternUppercase = Pattern.compile("[A-Z]");
Pattern patternLowercase = Pattern.compile("[a-z]");
int countCapitals = 0;
int countLowcaseCharacters = 0;
Matcher m = patternUppercase.matcher(string);
while (m.find()) {
countCapitals++;
}
m = patternLowercase.matcher(string);
while (m.find()) {
countLowcaseCharacters++;
}