// | 作分隔符非常特殊,不能用“|”来split,只能用"\\|"或者"[|]"
import java.lang.String;
public class testSplit {
public static void main(String[] args){
int i=0, j=0;
String[] temp1,temp2;
String X = "2|33|4";
String Y ="A_B_C";
temp1 = X.split("\\|"); //"[|]"
temp2 = Y.split("_");
while(i<temp1.length ){
System.out.println(temp1[i]);
i++;
}
while(j<temp2.length ){
System.out.println(temp2[j]);
i++;
}
}
}
参考: http://www.cnblogs.com/liubiqu/archive/2008/08/14/1267867.html