- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChapter43.java
More file actions
Latest commit
23 lines (19 loc) · 821 Bytes
/
Copy pathChapter43.java
File metadata and controls
23 lines (19 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
packagechapter43;
importjava.util.StringTokenizer;
publicclassString3Ex {
publicstaticvoidmain(String[] args) {
System.out.println("=======StringTokenizer 클래스===");
Stringquery = "https://www.google.co.kr/webhp?tab=rw";//내용 바꿈
StringTokenizerst = newStringTokenizer(query, "/.");
//구분자로 분리된 토큰 개수
intn = st.countTokens();
System.out.println("토큰 개수 : "+n);
System.out.println("----------------------------------");
//구분자로 분리해 놓은 토큰 하나씩 읽어오기
while (st.hasMoreTokens()) {
Stringtoken = st.nextToken();//분리된 토큰 얻어오기
System.out.println(token);//읽어온 토큰을 저장한 변수 token 출력
}
}
}