java check if string has uppercase code example
Example 1: java check string contains uppercase character
public boolean containsUpperCaseLetter(String s){
for(int i=0;i<s.length();i++){
if(Character.isUpperCase(s.charAt(i))){
return true;
}
}
return false;
}
Example 2: java check string contains uppercase character
yourString.chars().anyMatch(Character::isUpperCase)