설.현.아빠
StringTokenizer API 본문
A StringTokenizer object internally maintains a current position within the string to be tokenized. Some operations advance this current position past the characters processed. A token is returned by taking a substring of the string that was used to create the StringTokenizer object. The following is one example of the use of the tokenizer. The code: StringTokenizer st = new StringTokenizer("this is a test"); while (st.hasMoreTokens()) { System.out.println(st.nextToken()); } prints the following output: this is a test StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead. The following example illustrates how the String.split method can be used to break up a string into its basic tokens: String[] result = "this is a test".split(\\s); for (int x=0; x<result.length; x++) System.out.println(result[x]); prints the following output: this is a test
'안드로이드 > String' 카테고리의 다른 글
FileReader FileNotFoundException 에러 관련 질문 (StringTokenizer 사용 예제 포함.) (0) | 2011.02.11 |
---|---|
StringTokenizer와 split 구현 예제. (0) | 2011.02.11 |
[JAVA] String형 비교하기, 문자열 비교하기 (0) | 2011.02.11 |
CharSequence Interface의 이해. (0) | 2011.02.11 |
자바코드에서 String.xml의 String값 가져다 쓰기. (0) | 2011.02.11 |