HELLO printing in a double quote in .tsv file because of '#' like "#HELLO". I want to remove the double quotes when it writes to .tsv
current output -> "#HELLO"
expected output -> #HELLO
try ( CSVPrinter printer = new CSVPrinter(new FileWriter("data.tsv"), CSVFormat.TDF))
{
printer.printRecord("#HELLO");
}catch (IOException ex) {
ex.printStackTrace();
}
CodePudding user response:
You need to adjust format
CSVFormat.Builder.create(CSVFormat.TDF)
.withQuoteMode(QuoteMode.MINIMAL)
.build();
CodePudding user response:
I changed the version of CSVCommons to 1.8 and below code is working for me...
CSVPrinter printer = new CSVPrinter(new FileWriter("data.tsv"), CSVFormat.TDF.withHeader("#default1", "default2").withEscape('"').withQuoteMode(QuoteMode.NONE)