我需要如何编码以使数组 token[] 不会读取空值?代码如下。
String[] token = new String[0];
String opcode;
String strLine="";
String str="";
try{
// Open and read the file
FileInputStream fstream = new FileInputStream("a.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
//Read file line by line and storing data in the form of tokens
if((strLine = br.readLine()) != null){
token = strLine.split(" |,");//// split w.r.t spaces and ,
// what do I need to code, so that token[] doesnt take null values
}
}
in.close();//Close the input stream
}