生成csv文件

来源:互联网 发布:密码签到软件破解 编辑:程序博客网 时间:2024/06/06 18:41
String filepass= "c:/tmp/aa.csv";
try (BufferedWriter output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filepass),"UTF-8")))
{
StringBuffer result = new StringBuffer();


result = new StringBuffer();


result.append("\"");
result.append("aa");
result.append("\"");
result.append(",");


result.append("\"");
result.append("bb");
result.append("\"");
result.append("");


output.write(result.toString());
output.write("\r\n");


//new line
result = new StringBuffer();
result.append("\"");
result.append("cc");
result.append("\"");
result.append(",");


result.append("\"");
result.append("dd");
result.append("\"");
result.append("");


output.write(result.toString());
output.write("\r\n");


//close
output.close();


} catch (IOException e) {


}
原创粉丝点击