JAVA-클래스의 중요메소드/ String클래스
JAVA-중요01-String클래스
IT-개발자
2018. 6. 21. 21:25
반응형
아래는 String 클래스의 메소드들입니다. 그 중에서 가장 많이 사용하는 메소들을 정리하였으며 주요 메소들을 설명 드리도록 하겠습니다.
String 클래스는 문자열 데이터값을 저장하는 객체로 사용됩니다. 또한, 문자열은 변경될 수 없습니다.
boolean | equals (Object anObject) |
Compares this string to the specified object. |
int | length() | Returns the length of this string. |
int | indexOf (int ch) |
Returns the index within this string of the first occurrence of the specified character. |
char | charAt(int index) | Returns the char value at the specified index. |
string | replace (char oldChar, char newChar) |
Replaces each substring of this string that
matches the literal target sequence with the specified literal replacement sequence. |
string | substring (int beginIndex) |
Returns a string that is a substring of this string. |
string | substring (int beginIndex, int endIndex) |
Returns a string that is a substring of this string. |
string | toString() | This object (which is already a string!) is itself returned. |
string | toLowerCase() | Converts all of the characters in this String to lower case using the rules of the default locale. |
string | toUpperCase() | Converts all of the characters in this String to upper case using the rules of the default locale. |
string | trim() | Returns a string whose value is this string, with any leading and trailing whitespace removed. |
string | concat(String str) | Concatenates the specified string to the end of this string. |
sring[] | split(String regex) | Splits this string around matches of the given regular expression. |
다음 강의에서 위의 String클래스의 메소드들을 확인해보도록 하겠습니다.
아주 유용한 메소들로 많이 사용되니 상세히 파악해보도록 하겠습니다.
다음 강의를 참고해주세요.
자료가 마음에 드셨다면 자주 찾아주세요^^ 글 올리는데 힘이됩니다.
반응형