JAvaセパレータ文字列変換文字列配列
640 ワード
//
public static String[] split(String source){
if(source == null || source.trim().equals("")) return null;
//‘,’
StringTokenizer commaToker = new StringTokenizer(source, ", ");
String[] result = new String[commaToker.countTokens()];
int m=0;
while(commaToker.hasMoreTokens()){
result[m] = commaToker.nextToken();
m++;
}
return result;
}
String[] arr = str.split(",");