Uploaded image for project: 'Commons CSV'
  1. Commons CSV
  2. CSV-148

CSVFormat.ignoreSurroundingSpaces is ignored when printing

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.1
    • Fix Version/s: Review
    • Component/s: Printer
    • Labels:
      None
    • Environment:

      JDK 1.7

      Description

      It seems that CSVFormat's property ignoreSurroundingSpaces is not taken into consideration while printing out values using CSVPrinter.

      Given:

      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     ")
      );
      

      Actual result:

      ""," "," 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     "
      

      Expected result:

      "","","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"
      

        Attachments

        1. commons-csv_CSV-148.patch
          0.6 kB
          Pratiyush
        2. commons-csv_CSV-148.patch
          2 kB
          Niels Bischof

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                cpio Piotr Ciruk
              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m