csv.k 265 B

12345678910
  1. / ngn/k
  2. \d csv
  3. ESC: "\"" / escape
  4. ROW: "\n" / row separator
  5. FLD: "," / field separator
  6. uq:{$[*q:x=ESC;-1_x@&~q&2!+\q;x]} / unquote
  7. sp:{[s;x](1&l)_'(l:0,&(2!+\x=ESC)<x=s)_x} / split
  8. csv:{uq''sp[FLD]'sp[ROW;x]} / parse CSV
  9. \d .