如果我有
String a = "abc,,,";
我该怎么做才能获得
result[0].equals("abc");
result[1].equals(",,,");
答案 0 :(得分:1)
最基本的方式是:
final int pos = a.indexOf(',');
if( pos == -1 ) { // character not found, handle this case somehow }
String [] result = new String [2];
result[0]=a.substring(0, pos);
result[1]=a.substring(pos);