일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- 코딩부트캠프
- js
- 코딩수업
- 스마트리움
- 초등학생 코딩수업
- 도서관 수업
- html
- 2024겨울방학 코딩부트캠프
- 콜백함수
- 알티노
- spring
- jsp
- spring boot
- 자바
- Spring Security
- transaction
- 초등학생 겨울방학 놀이
- 서울시여성가족재단
- 자율주행자동차
- 뚜루뚜루
- 핑퐁로봇
- 2024우먼테크위크
- 2023 ICT R&D 주간
- 이것이 자바다
- 드론
- 은평구립도서관
- Cos Pro
- 초등학교 코딩수업
- Java
- CSS
- Today
- Total
블로그
[JAVA] Class String, Arrays 주요 메소드 본문
Class String
Package java.lang
Method
char
charAt(int index)
Returns the char value at the specified index.
boolean
equals(Object anObject)
Compares this string to the specified object.
void
getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Copies characters from this string into the destination character array.
The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1 (thus the total number of characters to be copied is srcEnd-srcBegin). The characters are copied into the subarray of dst starting at index dstBegin and ending at index:
dstBegin + (srcEnd-srcBegin) - 1
int
indexOf(String str)
Returns the index within this string of the first occurrence of the specified substring.
boolean
isBlank()
Returns true if the string is empty or contains only white space codepoints, otherwise false.
boolean
isEmpty()
Returns true if, and only if, length() is 0.
int
length()
Returns the length of this string.
String
replace(char oldChar, char newChar)
Returns a string resulting from replacing all occurrences of oldChar in this string with newChar.
String[]
split(String regex)
Splits this string around matches of the given regular expression.
String
substring(int beginIndex, int endIndex)
Returns a string that is a substring of this string.
Returns a string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.
Examples:
"hamburger".substring(4, 8) returns "urge"
"smiles".substring(1, 5) returns "mile"
char[]
toCharArray()
Converts this string to a new character array.
String
toLowerCase(Locale locale)
Converts all of the characters in this String to lower case using the rules of the given Locale.
String
toUpperCase()
Converts all of the characters in this String to upper case using the rules of the default locale.
String
toString()
This object (which is already a string!)
static String
valueOf(char[] data)
Returns the string representation of the char array argument.
static String
valueOf(int i)
Returns the string representation of the int argument.
The representation is exactly the one returned by the Integer.toString method of one argument.
Class Arrays
Package java.util
Method
static char[]
copyOf(char[] original, int newLength)
Copies the specified array, truncating or padding with null characters (if necessary) so the copy has the specified length.
static int[]
copyOf(int[] original, int newLength)
Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.
static char[]
copyOfRange(char[] original, int from, int to)
Copies the specified range of the specified array into a new array.
static boolean
equals(char[] a, char[] a2)
Returns true if the two specified arrays of chars are equal to one another.
static void
fill(int[] a, int val)
Assigns the specified int value to each element of the specified array of ints.
static int
mismatch(boolean[] a, boolean[] b)
Finds and returns the index of the first mismatch between two boolean arrays, otherwise return -1 if no mismatch is found
static void
sort(char[] a)
Sorts the specified array into ascending numerical order.
static void
sort(char[] a, int fromIndex, int toIndex)
Sorts the specified range of the array into ascending order.
static String
toString(double[] a)
Returns a string representation of the contents of the specified array.
'개발자 준비과정 > JAVA' 카테고리의 다른 글
[JAVA] instanceof 연산자 (0) | 2024.03.11 |
---|---|
[JAVA] 객체 배열... (3) | 2024.03.07 |
[JAVA] Call By Value (0) | 2024.03.04 |
[JAVA] 참조타입의 특징 (0) | 2024.03.01 |
[JAVA] 반복문 for, while, do-while 그리고 break,continue (0) | 2024.03.01 |