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

Provide access methods for header and trailer comments

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.9.0
    • 1.10.0
    • Parser
    • None

    Description

      The Apache Commons CSV library can deal with comments by attaching the comment to the following record.
      It does not seem possible to access comments that are before the header line ("header comments"), or after the last record ("trailer comments")
      I feel this would be a useful enhancement to the current comment-handling features of version 1.9.

      I have not been able to find mention of this in other JIRA tickets.

      I have attached a patch implementing this, for discussion purposes. (n.b. I had trouble with git showing spurious ^M at the end of changed lines in CSVParserTest.java which I could not get rid of)

      This adds methods String CSVParser::getHeaderComment(), String CSVParser::getTrailerComment(), bool CSVParser::hasHeaderComment() and bool CSVParser::hasTrailerComment() . The last two could be omitted assuming a missing comment would return a null String.

       

      See also https://stackoverflow.com/questions/72619095/get-leading-comments-from-csv-with-apache-commons-csv and https://lists.apache.org/thread/8tczpqlnjgbcyovyhb484tt11vqv91jt

      Attachments

        1. header-comment.patch
          10 kB
          Peter Hull

        Activity

          People

            Unassigned Unassigned
            peterhull90 Peter Hull
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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