Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import Foundation
let content = "abc,cde,128,256\nefg,ghi,42" //string with CSV file content
// parsing
let parsedCSV: [[String]] = content.components(separatedBy: "\n").map{ $0.components(separatedBy: ",") }
print(parsedCSV)
// ["abc","cde","128","256"],["efg","ghi","42"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment