Repository navigation
First public release.
CSVParserparses RFC 4180 CSV into aCSVTableof UTF-8 string fields:- LF and CRLF records, an optional final line break and a skipped UTF-8 BOM;
- quoted fields with delimiters, line breaks and
""escapes; - comma, semicolon, tab or pipe delimiters;
- a required header by default (non-empty, unique names, exact field counts), or
header-less records; - each record's 1-based starting line.
- No type guessing, trimming, padding or repair: malformed input fails.
CSVLimitsbounds input bytes, records, fields per record and field bytes.
Cancellation is supported.CSVErrorreports 15 stable codes with a 1-based line and column.CSVJSON(optional product, Swift-JSON 1.9.0) converts records to header-keyed
JSONObjects of strings with an explicitCSVEmptyCellpolicy:missing,nullor
emptyString.- All 12 csv-spectrum 2.0.0 cases are run: 11 match, 1 documented rejection.
- Tested on macOS, Linux x86_64 and arm64, and WebAssembly (WASI).
Installation
.package(url: "https://github.com/ThorFuchs/Swift-CSV.git", from: "0.1.0")Products: CSV (standard library only) and CSVJSON (Swift-JSON 1.9.0).
Documentation: https://thorfuchs.github.io/Swift-CSV/documentation/csv/