我正在使用apache commons CSV来写入csv文件。我想继续使用这个库。当我写一个csv文件时,在生成的文件的第一列中,它包含双引号作为引号字符,而其他列按预期生成。
我真的想在这里去掉双引号。请查看下面的代码。
CSVFormat format = CSVFormat.DEFAULT;
FileWriter fw = new FileWriter("Temp.csv");
CSVPrinter printer = new CSVPrinter(fw, format);
String[] temp = new String[4];
for(int i=0; i<4; i++) {
if(i==1)
temp[0] = "#";
else
temp[0] = "";
temp[1] = "hello" + (i+1);
temp[2] = "";
temp[3] = "test";
Object[] temp1 = temp[]
printer.printRecord(temp1);
}
fw.close();
printer.close();
Temp.csv
"",hello1,,test
"#",hello2,,test
"",hello3,,test
"",hello4,,test
我不想每行开头都有引号,我只想要一个没有引号的空字符串,就像第三列一样。是否有人可以帮忙解决?