java.util.StringTokenizerの使い方

サンプルコード下記

package com.arkgame.study;

import java.util.StringTokenizer;

public class StringTokenizerDemo {

	public static void main(String[] args) {
		String cft = "456,010,119";
		StringTokenizer bb = new StringTokenizer(cft, ",");
		int length = bb.countTokens();
		String[] kdf = new String[length];
		for (int i = 0; i < length; i++) {
			kdf[i] = bb.nextToken();
			System.out.println(kdf[i]);
		}
	}

}

結果
456
010
119

Java

Posted by arkgame