[JAVA] 문자 대소문자 구분

[JAVA] 문자 대소문자 구분

Character.isUpperCase() Character.isLowerCase() true, false로 반환한다.

String 문자열을 받아서 문자들이 대문자인지 소문자인지 구별하는 방법

String str = "aBcDeFg"; for( char c : str.toCharArray()) { if ( Character.isUpperCase(c)) { System.out.println("true"); }else { System.out.println(false); } }

실행 결과>

from http://sloth.tistory.com/42 by ccl(A) rewrite - 2021-11-08 11:02:07