当我使用此功能写入csv文件时,所有数据都嵌入在双引号中。
有没有一种方法可以在没有双引号的情况下写入csv文件?
CSVWriter writer = new CSVWriter(new FileWriter(table+".csv"), '\t');
writer.writeAll(rset, true);
writer.close();
该文件包含以下形式的数据
"EMPNO" "ENAME" "JOB" "MGR" "HIREDATE" "SAL" "COMM" "DEPTNO" "TAG" "LOOKUP"
"7369" "SMITH" "CLERK" "7902" "17-Dec-1980" "800" "2" "20" "E" "1"
"7499" "ALLEN" "SALESMAN" "7698" "20-Feb-1981" "1600" "2" "30" "E" "2"
"7521" "WARD" "SALESMAN" "7698" "22-Feb-1981" "1250" "2" "30" "E" "3"
"7566" "JONES" "MANAGER" "7839" "02-Apr-1981" "2975" "2" "20" "E" "2"
最佳答案
CSVWriter writer = new CSVWriter(new FileWriter(table+".csv"), '\t', CSVWriter.NO_QUOTE_CHARACTER);
writer.writeAll(rset, true);
writer.close();
引用:opencsv CSVWriter JavaDoc