try {
BufferedReader input =new BufferedReader(new FileReader(targetPath));
while ((f=input.readLine())!=null) {
String info[] = f.split(" ");
HashMap map=new HashMap<>();
if(xfname!=null){
xfname=new String(ServletActionContext.getRequest().getParameter("xfname").getBytes(),"UTF-8");
map.put("code", info[0].trim());
map.put("area", xfname);
list.add(map);
System.out.println(list);
}else{
map.put("code", info[0].trim());
list.add(map);
}
}
} catch (Exception e) {
}
代码这样每次只能读取一行 如何读取三行的info[0]再进入下一次循环呢
readline遇到空行会读取一个空字符串 如何能去掉这个空字符串 要不然list中会有很多的空字符串- -
追答......