我正在使用csvreader/write
来创建csv文件,但是当我尝试使用String
附加或写入csv时,它也会添加双引号。
import com.csvreader.CsvWriter;
public class CSVFile {
private static final String defaultHeaders = "Node Name,Node IP,Object Name,DateTime";
CsvWriter csvOutput = new CsvWriter(new FileWriter(user+currDateTime+".csv", true),',');
csvOutput.write(defaultHeaders);
}
csv的输出是:
“节点名称,节点IP,对象名称,日期时间”
我需要:
节点名称,节点IP,对象名称,日期时间
答案 0 :(得分:0)
您是否尝试过writeRecord方法?
private static final String defaultHeaders = {"Node Name", "Node IP", "Object Name", "DateTime"};
CsvWriter csvOutput = new CsvWriter(new FileWriter(user+currDateTime+".csv", true),',');
csvOutput.writeRecord(defaultHeaders);