[ 
https://issues.apache.org/jira/browse/CSV-299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17727969#comment-17727969
 ] 

Peter Hull commented on CSV-299:
--------------------------------

I did some bisecting and I believe it was fixed by commit 
[c15a06e|https://github.com/apache/commons-csv/commit/c15a06eee95e227fbe5c61849dd12b7bf126016a]

> get unexpected results when setting the delimiter to ‘||’
> ---------------------------------------------------------
>
>                 Key: CSV-299
>                 URL: https://issues.apache.org/jira/browse/CSV-299
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 1.9.0
>            Reporter: Panxianhao
>            Priority: Minor
>             Fix For: 1.10.0
>
>         Attachments: image-2022-07-26-11-24-43-484.png, 
> image-2022-07-26-11-27-23-629.png, image-2022-07-26-11-29-15-281.png, 
> image-2022-07-26-11-29-54-455.png, image-2022-07-26-11-31-57-920.png, 
> image-2022-07-26-11-32-25-643.png
>
>
> a simple but strange problem
> the csv file is like 
> !image-2022-07-26-11-24-43-484.png|width=497,height=51!
> and the parse code is 
>  
> {code:java}
> File csv = new File("src/main/resources/test.csv");
> CSVFormat format = CSVFormat.Builder.create()
>         .setDelimiter("||")
>         .setRecordSeparator("\n")
>         .build();
> Iterable<CSVRecord> records = format.parse(new FileReader(csv));
> for (CSVRecord record : records) {
>     System.out.println(record);
> } {code}
> the output should be 
> YW-20210402-Z3N9X
> 0
> 13500900001|*|\{"name":"Mr.Chen13500900001"}
> ----
> but I get the wrong result
> !image-2022-07-26-11-27-23-629.png|width=557,height=36!
> ----
> if I add a space after the 0 like this 
> !image-2022-07-26-11-29-15-281.png|width=546,height=35!
> I can get the result I want
> !image-2022-07-26-11-29-54-455.png|width=552,height=31!
> ----
> if I change the number >=10  without a space it works just fine
> !image-2022-07-26-11-31-57-920.png|width=519,height=30!
> !image-2022-07-26-11-32-25-643.png|width=528,height=26!
> ----
> Hope I can get reply from you, thx!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to