CSVFormat の quoteMode が MINIMAL に設定されている場合、 javadocに従って、値に区切り文字 (,) または行区切り文字 '\n' が含まれている場合にのみ、値を引用する必要があります。ただし、値にハッシュ (#) が含まれていても引用します。以下のサンプルコードを参照してください
@Test
public void testCSV() throws IOException {
String[] row = new String[]{"simple text","##5##"};
CSVFormat CSV_FORMAT = CSVFormat.DEFAULT.withRecordSeparator("\n").withQuoteMode(QuoteMode.MINIMAL);
StringWriter stringWriter = new StringWriter(1024);
CSVPrinter csvPrinter = new CSVPrinter(stringWriter, CSV_FORMAT);
csvPrinter.printRecord(row);
System.out.println("sw : " + stringWriter.getBuffer().toString());
csvPrinter.close();
stringWriter.close();
}
出力: sw : 単純なテキスト、"##5##"
そのような場合に引用を避けることができる方法を提案してください。