I am trying to parse a csv string in clojure with escaped commas and no quote around fields like this one
"test1\,test2,test3"
I tried this libraries:
But none of them seems capable to recognize this correctly as ["test1,test2" "test3"]
Does someone know a library which can do this?
Thanks in advance
You're not exactly parsing CSV data, but some derivation of the convention (note I didn't write "standard").
In CSV, commas are not escaped. That is something leaking into your data from C/C++/Java string escaping. If it were typical CSV, it would be written like this
"a,b",c
Which clojure-csv supports.
user=> (csv/parse-csv (str "\"a,b\",c"))
(["a,b" "c"])
You likely will have to write your own parser, or extend one of the aforementioned libraries, to handle this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With