How to parse CSV files with double-quoted strings in Julia?

csv, julia, string

Solution

The `readcsv` function in base is super-basic (just blindly splitting on commas).

You will probably be happier with `readtable` from the DataFrames.jl package: http://juliastats.github.io/DataFrames.jl/io.html

To use the package, you just need to Pkg.add("DataFrames"), and then import it with `using DataFrames"

Problem

I want to read CSV files where the columns are separated by commas. The columns can be strings and if those strings contain a comma in their content, they are wrapped in double-quotes. Currently I'm loading my data using: ``` file = open("data.csv","r") data = readcsv(file) ``` But this code code would split the follwing string into 4 pieces whereas it only should be 3: 1,"text, more text",3,4 Is there a way in Julia's Standard Library to parse CSV while respecting quoting or do I have to write my own custom solution?

Original source