StringTokenizer commaToker = new StringTokenizer(s, ","); String[] result = new String[commaToker.countTokens()]; int k = 0; while (commaToker.hasMoreTokens()) { result[k] = commaToker.nextToken(); k++; }
StringTokenizer commaToker = new StringTokenizer(s, "\\");
这样可以么?呵呵,我也是初学者~~~~
String[] result = new String[commaToker.countTokens()];
int k = 0;
while (commaToker.hasMoreTokens()) {
result[k] = commaToker.nextToken();
k++;
}