/**
* 分割字符串,去除字符串中的所有空格---1
* */
protected String[] splitString(String lineString){
ArrayList list = new ArrayList();
String[] columnArray = null;
//字符串如果含有空格,则空格为“半角状态下的空格”,如果为全角状态下,则空格长度为1
// String lineString = " z j p ";
lineString = lineString.trim();
char[] chars = lineString.toCharArray();
int length = chars.length;
for(int i = 0; i < chars.length; i++){
if(String.valueOf(chars[i]).trim().length()<1){
length --;
}else{
list.add(String.valueOf(chars[i]));
}
}
columnArray = (String[])list.toArray(new String[length]);
return columnArray;
}
例如lineString =" z j p ", 则最后的columnArray数组内容为{z,j,p},长度为3