Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Steps to reproduce :
1. Parse CSV file with || as delimiter and having empty columns
2. Print the CSVRecord resulting from CSVParser
//Expected : a,b,c,d,,f,g
// Actual : a,b|c,d,|f,g
public static void main(String[] args) throws Exception{
String row = "a||b||c||d||||f||g";
StringBuilder stringBuilder = new StringBuilder();
try (CSVPrinter csvPrinter = new CSVPrinter(stringBuilder, CSVFormat.EXCEL);
CSVParser csvParser = CSVParser.parse(new StringInputStream(row), StandardCharsets.UTF_8, CSVFormat.Builder.create().setDelimiter("||").build())) {
for (CSVRecord csvRecord : csvParser) {
for (int i = 0; i < csvRecord.size(); i++)
System.out.println(stringBuilder.toString());
//Expected : a,b,c,d,,f,g
// Actual : a,b|c,d,|f,g
}
}
}
With the snippet provided above, actual value is not same as expected value
Attachments
Issue Links
- is related to
-
CSV-206 Add support for String delimiters #76
- Resolved