Daniel1of1 / CSwiftV

A csv parser written in swift conforming to rfc4180
BSD 3-Clause "New" or "Revised" License
171 stars 46 forks source link

CSV without headers #22

Open mariovillamizar opened 8 years ago

mariovillamizar commented 8 years ago

I'm downloading a cvs file without headers. I'm getting the next cvs string:

0.183764, -0.309156, 0.492920
0.183765, -0.309157, 0.492921
0.183766, -0.309158, 0.492922

Actually this library is taking as header the elements of the first row, and the rows are the elements of second a third rows from the downloaded string. I have fixed this bug with this code:

let csv = CSwiftV(string: csvString, separator: ",", headers: [String](count: 3, repeatedValue: "")) However, is there any way to disable the headers when these doesn't exist?... If not, can you add this to the library please?.. Maybe something like this:

let csv = CSwiftV(string: csvString, headersExist: false)

Daniel1of1 commented 8 years ago

Hi, Sorry for such a late response. This is a really good issue. I don't have too much time at the moment, but I'll keep the issue open and it will be the next new feature to add.