Character 클래스의 isAlphabetic(intcodePoint) 메소드는 지정된 문자가 알파벳인지 여부를 판별합니다.
문자가 다음과 같은 특성을 갖는 경우 문자로 간주됩니다.
- 대문자_문자
- LOWERCASE_LETTER
- TITLECASE_LETTER
- MODIFIER_LETTER
- OTHER_LETTER
- LETTER_NUMBER 또는
- 유니코드 표준에 의해 정의된 기타 알파벳입니다.
통사론
public static Boolean isAlphabetic(int codePoint)
매개변수
코드포인트 : 테스트 대상 캐릭터입니다.
자바 입력
반환 값
isAlphabetic(intcodePoint) 메서드는 문자가 유니코드 알파벳 문자인 경우 true를 반환합니다. 그렇지 않으면 이 메서드는 false를 반환합니다.
실시예 1
public class JavaCharacterisAlphabeticExample1 { public static void main(String[] args) { char codepoint1 = '0'; char codepoint2 = '1'; boolean b1 = Character.isAlphabetic(codepoint1); boolean b2 = Character.isAlphabetic(codepoint2); System.out.println('The returned value for the first character is given as:'+' '+b1); System.out.println('The returned value for the first character is given as:'+' '+b2); } }지금 테스트해보세요
산출:
The returned value for the first character is given as: false The returned value for the first character is given as: false
실시예 2
public class JavaCharacterisAlphabeticExample2 { public static void main(String[] args) { // Initialize the codepoints int codepoint1 = 87; int codepoint2 = 49; int codepoint3 = 63; // Check if the first codepoint is alphabet or not. boolean checkAlp1 = Character.isAlphabetic(codepoint1); if(checkAlp1){ System.err.print('Codepoint ''+codepoint1+'' is an alphabet. '); } else{ System.out.print('Codepoint ''+codepoint1+'' is not an alphabet. '); } // Check if the second codepoint is alphabet or not. boolean checkAlp2 = Character.isAlphabetic(codepoint2); if(checkAlp2){ System.err.print('Codepoint ''+codepoint2+'' is an alphabet. '); } else{ System.out.print('Codepoint ''+codepoint2+'' is not an alphabet. '); } // Check if the third codepoint is alphabet or not. boolean checkAlp3 = Character.isAlphabetic(codepoint3); if(checkAlp3){ System.err.print('Codepoint ''+codepoint3+'' is an alphabet. '); } else{ System.out.print('Codepoint ''+codepoint3+'' is not an alphabet. '); } } }지금 테스트해보세요
산출:
Codepoint '87' is an alphabet. Codepoint '49' is not an alphabet. Codepoint '63' is not an alphabet.
실시예 3
public class JavaCharacterisAlphabeticExample3 { public static void main(String[] args) { char codepoint1 = '1'; char codepoint2 = 'A'; char codepoint3 ='B'; boolean b1 = Character.isAlphabetic(codepoint1); boolean b2 = Character.isAlphabetic(codepoint2); boolean b3 = Character.isAlphabetic(codepoint3); System.out.println('The returned value for the first character is given as:'+' '+b1); System.out.println('The returned value for the second character is given as:'+' '+b2); System.out.println('The returned value for the third character is given as:'+' '+b3); } }지금 테스트해보세요
산출:
The returned value for the first character is given as: false The returned value for the second character is given as: true The returned value for the third character is given as: true