日期:2014-05-20 浏览次数:20839 次
String str = "你好,\"我们,是一,块,的\",HEllo,World,\"我们,也是,一块的\"";
boolean fh = false ;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if('\"' == c){
fh = !fh ;
}
if(c == ',' && !fh){
System.out.println(sb.toString());
sb.delete(0, sb.length());
}else{
sb.append(c);
}
}
System.out.println(sb.toString());