0

Hey guys I'm using CSVImporter framework to import CSV files on IOS development. I already search through the documentation about importing multiple data into array.

This is from their site

let path = "path/to/Hogwarts/students"
let importer = CSVImporter<Student>(path: path)
importer.startImportingRecords { recordValues -> Student in

return Student(firstName: recordValues[0], lastName: recordValues[1])

}.onFinish { importedRecords in

for student in importedRecords {
    // Now importedRecords is an array of Students
}
}

which shows that the data from 1 row could be separated into recordValues array

and this is my code , you can see that on my code the recordValues is not divided into array, instead all of the data in a row is combined into recordValues[0] and still separated by ; (semicolon). I can overcome this by separating the string with semicolon symbol, but has anyone ever had this issue? I want to know the problem on my code.

Cheers!

Robert Tirta
  • 2,593
  • 3
  • 18
  • 37
  • csv = comma separated values - your values are **not** comma separated but semicolon separated. – luk2302 Apr 08 '17 at 12:13
  • @luk2302 so it doesn't work with semicolon separated? because I thought csv could be created both with colon and semicolon.. I read this as well http://stackoverflow.com/questions/10140999/csv-with-comma-or-semicolon – Robert Tirta Apr 08 '17 at 12:16
  • 1
    Whatever you read on the internet the only thing that matters is wether or not the framework you are using right now is supporting semicolons, should be easy to find out, either by reading their docs or by simply trying it out. – luk2302 Apr 08 '17 at 12:17

1 Answers1

0

Turns out that CSVImporter only works on the "literally" comma separated value. if your file is CSV but turns out that it is separated by semicolon then it won't work

Robert Tirta
  • 2,593
  • 3
  • 18
  • 37