You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Chen (Jira)" <ji...@apache.org> on 2020/06/13 08:53:00 UTC

[jira] [Commented] (CSV-148) CSVFormat.ignoreSurroundingSpaces is ignored when printing

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

Chen commented on CSV-148:
--------------------------

This is a problem of use, not a bug.

I added test cases to illustrate the difference between withIgnoreSurroundingSpace() and withTrim() in PR #70

This should be resolved.

> CSVFormat.ignoreSurroundingSpaces is ignored when printing
> ----------------------------------------------------------
>
>                 Key: CSV-148
>                 URL: https://issues.apache.org/jira/browse/CSV-148
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Printer
>    Affects Versions: 1.1
>         Environment: JDK 1.7
>            Reporter: Piotr Ciruk
>            Priority: Minor
>             Fix For: Review
>
>         Attachments: commons-csv_CSV-148.patch, commons-csv_CSV-148.patch
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> It seems that {{CSVFormat}}'s property {{ignoreSurroundingSpaces}} is not taken into consideration while printing out values using {{CSVPrinter}}.
> Given:
> {code}
> System.out.println(
> 	CSVFormat.DEFAULT
> 			.withIgnoreSurroundingSpaces(true)
> 			.format("",
> 				" ",
> 				" Single space on the left",
> 				"Single space on the right ",
> 				" Single spaces on both sides ",
> 				"   Multiple spaces on the left",
> 				"Multiple spaces on the right    ",
> 				"  Multiple spaces on both sides     ")
> );
> {code}
> Actual result:
> {code}
> ""," "," Single space on the left","Single space on the right "," Single spaces on both sides ","   Multiple spaces on the left","Multiple spaces on the right    ","  Multiple spaces on both sides     "
> {code}
> Expected result:
> {code}
> "","","Single space on the left","Single space on the right","Single spaces on both sides","Multiple spaces on the left","Multiple spaces on the right","Multiple spaces on both sides"
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)