skelpo / CSV

A simple CSV file parser and serializer

Home Page:http://www.skelpo.codes/CSV/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for delimiters other than ","?

daSkier opened this issue · comments

I know this package is appropriately titled CSV, but has any thought been given to supporting delimiters other than ","?

I have a data set that I'm parsing right now that uses "\t" and I've modified the case statement in Parser.swift to be case 44,9: rather than case 44:. This isn't a great solution, but for the time being it works.

If you were interested in supporting this concept I would think abstracting the ascii code away would be a good idea. This could be done by either creating some sort of Delimiter enum or adding a Character parameter to the parse function.

Like it, @calebkleveter can you enable this? Should not be much work.

I put together a quick fork and PR that supports this by adding a delimiter parameter to the decode functions. I'm not sure if this is the best option, but I thought I'd try to help move this forward. See PR #7

As I was putting together this fork I saw that there is a CSVCodingOptions class. Something like this for the parser may be a better choice.

Fixed by #7