You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/09/03 08:43:27 UTC

[GitHub] [commons-csv] san4you88 edited a comment on pull request #76: [CSV-206] Add support for String delimiters

san4you88 edited a comment on pull request #76:
URL: https://github.com/apache/commons-csv/pull/76#issuecomment-912359970


   Hi All,
      I was testing the functionality to use string delimiter and found the following issue.
      
      ```
   public static void main(String[] args) throws Exception{
           String row = "a||b||c||d";
           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
                  // Actual : a,b|c,d
               }
           }
       }
   ```
   
   The actual value is different from expected, looks like the string delimiter doesn't work as expected when there is an empty column.
   Can some1 please confirm 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org