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
          2 kB
          Niels Bischof
        2. commons-csv_CSV-148.patch
          0.6 kB
          Pratiyush

          Activity

            People

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

              Dates

              • Created:
                Updated: