[ 
https://issues.apache.org/jira/browse/CSV-288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary D. Gregory resolved CSV-288.
---------------------------------
    Fix Version/s: 1.10.0
       Resolution: Fixed

[~san4you88], [~angusdev]
Please verify in git master and close.

> String delimiter (||) is not working as expected.
> -------------------------------------------------
>
>                 Key: CSV-288
>                 URL: https://issues.apache.org/jira/browse/CSV-288
>             Project: Commons CSV
>          Issue Type: Bug
>            Reporter: Santhsoh
>            Priority: Major
>             Fix For: 1.10.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 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++) {
>                  csvPrinter.print(csvRecord.get(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



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to