Skip to content

v1.1.0

Compare
Choose a tag to compare
@calebkleveter calebkleveter released this 20 May 16:54
· 16 commits to master since this release
8747b09

Configurable CSV Structures

You can now pass in a Config instance to the initializers for any of the Encoder/Decoder/Serializer/Parser types to define what characters are used for separating rows and as cell delimiters.

let config = Config(separator: "|", delimiter: "'")
let parser = SyncParser(config: config)

let csv = """
'first_name'|'last_name'
'Jonathan ''Jon'''|'Kernney'
"""
let data = parser.parse(Array(csv.utf8))

print(data) // ["first_name": ["Jonathan 'Jon'"], "last_name": ["Kerrney"]]