/***
* 字符串去分割符号 * pra: * str:待截取的字符串 * reg:按字符进行截取 * countRegNum:统计reg的个数+1 * * * */ public static String[] splitToArray(String str,String reg){ String countRegNum = str; int num = 0; while(true){ int j = countRegNum.indexOf(reg); if(j < 0) { num ++; break; }; countRegNum = countRegNum.substring(j+1); num ++; } if(num>0){ String[] splitStr = new String [num]; int i= 0; while(true){ int j = str.indexOf(reg); if(j < 0) { splitStr[i] = str; break; }; splitStr[i]= str.substring(0, j); str = str.substring(j+1); i++; } return splitStr; }else{ String[] splitStr = new String [0]; splitStr[0] = str; return splitStr; } }