indexOf, 아스키 코드, isDigit

박철진·2022년 10월 21일
0

1. 인덱스 오브

public int indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character. If a character with value ch occurs in the character sequence represented by this String object, then the index (in Unicode code units) of the first such occurrence is returned.

지정된 문자가 처음 발생한 이 문자열 내의 인덱스를 반환합니다. 이 String 객체가 나타내는 문자 시퀀스에서 값 ch를 가진 문자가 발생하면, 첫 번째 발생의 인덱스(유니코드 코드 단위)가 반환됩니다.

문자나 문자열 중에 해당하는 문자의 인덱스 값을 반환하고 찾지 못했을 경우 '-1'을 반환하는 메서드이다.

2. 아스키 코드 48 = 0


1️⃣ 숫자 = 0 ~ 9 / 48 ~ 57
2️⃣ 대문자 A = 65 ~ 90
3️⃣ 소문자 a = 97 ~ 122

3. Character.isDigit

public static boolean isDigit(char ch)
Determines if the specified character is a digit.
A character is a digit if its general category type, provided by Character.getType(ch), is DECIMAL_DIGIT_NUMBER.
Public static boolean isDigit(char ch)

지정된 문자가 숫자인지 확인합니다. Character.getType(ch)에서 제공하는 일반 카테고리 유형이 DECIMAL_DIGIT_NUMBER인 경우 문자는 숫자입니다.

숫자인지 문자인지 확인할 수 있다. 숫자인 경우 True / 문자인 경우 False로 return 된다.

profile
개발자를 위해 기록하는 습관

0개의 댓글