commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guang Chao <>
Subject Re: [CSV] Record Separator query
Date Thu, 10 Aug 2017 00:04:01 GMT
On Wed, Aug 9, 2017 at 6:12 AM, nitin mahendru <>

> Hello All,
> I am trying to read in a csv file which may be 'crlf' or 'lf' seperated.
> Then I want to change a particular column, say encrypt it and then write
> back a new csv with that updated column. I want to use the same record
> separator as was in the input file.
> Is there a way to get the record separator back from the CSVParser object ?
> I am planning to use the below method to get the writer.
> CSVFormat.RFC4180.withRecordSeparator(<need to add record
> separator).print()
> For using the above I need to know the record separator upfront which I
> have no clue about as the Parser object does not expose that detail.
> thanks
> Nitin

I think CSVParser is strict and may not work for both LF and CRLF.  Maybe
try to scan the file first and see if line ending is lf or crlf, and then
use a corresponding CSVParser instance that can handle each case.

Guang <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message