자바 튜토리얼

자바 홈 자바 소개 자바 시작하기 자바 구문 자바 주석 자바 변수 자바 데이터 유형 자바 타입 캐스팅 자바 연산자 자바 문자열 자바 수학 자바 부울 자바 If...Else 자바 스위치 자바 while 루프 자바 For 루프 자바 중단/계속 자바 배열

자바 메소드

자바 메소드 자바 메소드 매개변수 자바 메소드 오버로딩 자바 범위 자바 재귀

자바 클래스

자바 OOP 자바 클래스/객체 자바 클래스 속성 자바 클래스 메소드 자바 생성자 자바 수정자 자바 캡슐화 자바 패키지 / API 자바 상속 자바 다형성 자바 내부 클래스 자바 추상화 자바 인터페이스 자바 열거형 자바 사용자 입력 자바 날짜 자바 배열 목록 자바 링크드리스트 자바 해시맵 자바 해시셋 자바 반복자 자바 래퍼 클래스 자바 예외 자바 정규식 자바 스레드 자바 람다

자바 파일 처리

자바 파일 Java 파일 작성/쓰기 자바 읽기 파일 자바 삭제 파일

자바 방법

두 개의 숫자 더하기

자바 참조

자바 키워드 자바 문자열 메소드 자바 수학 메소드

자바 예제

자바 예제 자바 컴파일러 자바 연습 자바 퀴즈 자바 인증서


자바 문자열 메소드


모든 문자열 메서드

String 클래스에는 문자열에 사용할 수 있는 내장 메서드 집합이 있습니다.

Method Description Return Type
charAt() Returns the character at the specified index (position) char
codePointAt() Returns the Unicode of the character at the specified index int
codePointBefore() Returns the Unicode of the character before the specified index int
codePointCount() Returns the number of Unicode values found in a string. int
compareTo() Compares two strings lexicographically int
compareToIgnoreCase() Compares two strings lexicographically, ignoring case differences int
concat() Appends a string to the end of another string String
contains() Checks whether a string contains a sequence of characters boolean
contentEquals() Checks whether a string contains the exact same sequence of characters of the specified CharSequence or StringBuffer boolean
copyValueOf() Returns a String that represents the characters of the character array String
endsWith() Checks whether a string ends with the specified character(s) boolean
equals() Compares two strings. Returns true if the strings are equal, and false if not boolean
equalsIgnoreCase() Compares two strings, ignoring case considerations boolean
format() Returns a formatted string using the specified locale, format string, and arguments String
getBytes() Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array byte[]
getChars() Copies characters from a string to an array of chars void
hashCode() Returns the hash code of a string int
indexOf() Returns the position of the first found occurrence of specified characters in a string int
intern() Returns the canonical representation for the string object String
isEmpty() Checks whether a string is empty or not boolean
lastIndexOf() Returns the position of the last found occurrence of specified characters in a string int
length() Returns the length of a specified string int
matches() Searches a string for a match against a regular expression, and returns the matches boolean
offsetByCodePoints() Returns the index within this String that is offset from the given index by codePointOffset code points int
regionMatches() Tests if two string regions are equal boolean
replace() Searches a string for a specified value, and returns a new string where the specified values are replaced String
replaceFirst() Replaces the first occurrence of a substring that matches the given regular expression with the given replacement String
replaceAll() Replaces each substring of this string that matches the given regular expression with the given replacement String
split() Splits a string into an array of substrings String[]
startsWith() Checks whether a string starts with specified characters boolean
subSequence() Returns a new character sequence that is a subsequence of this sequence CharSequence
substring() Returns a new string which is the substring of a specified string String
toCharArray() Converts this string to a new character array char[]
toLowerCase() Converts a string to lower case letters String
toString() Returns the value of a String object String
toUpperCase() Converts a string to upper case letters String
trim() Removes whitespace from both ends of a string String
valueOf() Returns the string representation of the specified value String