你能帮我写代码吗?我想将 List 转换为 text.txt 格式应该如下:
private List<String>expDelLst =null;
expDelLst = new ArrayList<String>();
expDelLst = loginCountryBusServ.getExportDetails(userVO.getCtryCd());
FileWriter fos = new FileWriter("c:/data.txt");
PrintWriter out = new PrintWriter(fos);
for (int i = 0; i < expDelLst.size(); i++) {
out.write(StringUtils.join((Object[]) expDelLst.toArray()[i],"|"));
}
out.close();
and the how out put should be as: in text file.
F590|F590|CDG|590|FRDD|ESI|H|FR|GB|||11111111|598|598|T12|2012-12-20 12:10:30|
F590|F590|CDG|590|FRDD|ESU|W|FR|GB|||11111111|598|598|T12|2012-12-20 12:10:30|
F590|F590|CDG|590|FRDD|ESI|H|FR|FR|CDG|102|11111111|LF2|LF2|T33|2012-12-20 12:15:32|
F590|F590|CDG|590|FRDD|ESU|W|FR|FR|CDG|102|11111111|LF2|LF2|T33|2012-12-20 12:15:32|
F590|F590|CDG|590|FRDD|ESI|H|FR|FR|TLS|335|11111111|LF2|LF2|T57|2012-12-20 12:18:32|
F590|F590|CDG|590|FRDD|ESU|W|FR|FR|TLS|335|11111111|LF2|LF2|T57|2012-12-20 12:18:32|
F590|F590|CDG|590|FRDD|ESI|H|FR|FR|CDG|102|11111111|LF2|T33|B08|2012-12-20 12:25:52|
F590|F590|CDG|590|FRDD|ESU|W|FR|FR|CDG|102|11111111|LF2|T33|B08|2012-12-20 12:25:52|