import java.util.StringTokenizer;
public class Ex04_StringTokenizer {
public static void main(String[] args){
String str;
String[] ss;
int n;
str = "자바,안드로이드,HTML,스프링,오라클,javascript,JPA";
// 문자열을 토큰으로 구분하여 보냄
StringTokenizer st = new StringTokenizer(str, ","); // 구분자는 출력하지 않음(기본)
// StringTokenizer st = new StringTokenizer(str, ",", true); 구분자도 문자열로 출력
ss = new String[st.countTokens()]; // countTokens() : 보낼 문자열의 총 갯수
n = 0;
while(st.hasMoreTokens()) {
// true if and only if there is at least one token in the string after the current position; false otherwise
// 현재 위치 후에 1개 이상의 토큰이 있으면 true를 반환, 그렇지 않으면 false를 반환하는 boolean 리턴 메소드
ss[n++] = st.nextToken();
// 문자열 0칸부터 차례대로 st에 있는 토큰들을 넣어준다.
}
System.out.println("파싱된 문자열...");
for(int i=0; i<ss.length; i++) {
System.out.println(ss[i]);
}
}
}