In this challenge, given a CSV file as a string, you'll return the data contained as a 2d array of strings.
- The input consists of one or more records, delimited with
\n(line feed), or some other reasonable newline sequence of your choice
- A record consists of one or more fields, delimited with
\t(tabs), or some other reasonable delimiter of your choice. You may assume each record contains the same number of fields
- A field can either be quoted or un-quoted. An un-quoted field will not contain a field delimiter, newline sequence, or quote character, but may otherwise be an arbitrary non-empty string (within reason; you can assume things like invalid UTF-8, null characters, or unpaired surrogates won't appear if doing so is justifiable)
- A quoted string will be delimited on both sides by a quote character, which will be
`(backticks), or some other reasonable delimiter of your choice. This character will be escaped within the string by being repeated twice (the string unquoted
a"bcwould be represented as
"a""bc"). Quoted strings may contain field delimiters, newline sequences, escaped quote characters, and any other sequences of characters which may appear in an unquoted field. Quoted strings will always be non-empty
- You may choose to ignore the first record (as if it is a header record)
You may represent a 2d array in any reasonable format (excluding CSV or any of it's variants for obvious reasons).
This is code-golf, so shortest answer (in bytes) per language wins.
"abc",xyz "a""bc","""" ",",";" " "," "