반응형
String[] aa = "this is Sting split method".split("");
.split(" ") 괄호안에는 원하는거 암거나.
package com.timbuchalka;
public class Test {
public static void main(String[] args) {
String[] aa = "this is Sting split method".split(" "); // V
for (String i : aa) {
System.out.println(i);
}
System.out.println("================================");
String[] bb = "this is Sting, split method".split(","); // V
for (String i : bb) {
System.out.println(i);
}
}
}
//Output
D:\IT\JDK\jdk11.0.6_10\bin\java.exe "-javaagent:D:\IT\IDEA\IntelliJ IDEA Community Edition 2020.1\lib\idea_rt.jar=50891:D:\IT\IDEA\IntelliJ IDEA Community Edition 2020.1\bin" -Dfile.encoding=UTF-8 -classpath D:\IT\Java-Collections-Adventure-Game-challenge-Source-code\out\production\Adventure com.timbuchalka.Test
this
is //split이 " "일때
Sting
split
method
================================
this is Sting //split이 "," 일때
split method
Process finished with exit code 0
'JavaCode(review)' 카테고리의 다른 글
HashSet Interface- collection (0) | 2020.07.09 |
---|---|
Immutable class // Location Class- adventure game 이용 (0) | 2020.07.07 |
Map Interface - Collection - Adventure Game Challenge. (0) | 2020.07.06 |
Map Interface - collection (0) | 2020.07.05 |
Comparable / Comparator - Theater 코딩 이용 (0) | 2020.07.04 |