simpleweb/CSwiftV

Name: CSwiftV

Owner: Simpleweb

Description: A csv parser written in swift conforming to rfc4180

Forked from: Daniel1of1/CSwiftV

Created: 2016-10-07 14:32:31.0

Updated: 2016-10-07 14:32:32.0

Pushed: 2016-12-03 15:56:47.0

Homepage:

Size: 83

Language: Swift

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

CSwiftV

A csv parser conforming (and tested as much) to rfc4180 i.e the closest thing to a csv spec.

It is currently all in memory so not suitable for very large files.

TL;DR
inputString = "Year,Make,Model,Description,Price\r\n1997,Ford,E350,descrition,3000.00\r\n1999,Chevy,Venture,another description,4900.00\r\n"

csv = CSwiftV(String: inputString)

rows = csv.rows // [
                //  ["1997","Ford","E350","descrition","3000.00"],
                //  ["1999","Chevy","Venture","another description","4900.00"]
                // ]

headers = csv.headers // ["Year","Make","Model","Description","Price"]

keyedRows = csv.keyedRows // [
                          //  ["Year":"1997","Make":"Ford","Model":"E350","Description":"descrition","Price":"3000.00"],
                          //  ["Year":"1999","Make":"Chevy","Model":"Venture","Description":"another, description","Price":"4900.00"]
                          // ]

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.