Be careful with CSV formatted data.
- Be aware that there is no official standard for CSV.
- If you mean double quotes with "inverted commas", then be also aware that they serve a certain purpose: the string between the quotes may contain the separator character as well as quotes character (mostly escaped by doubling the quotes character).
E.g. a 3-column CSV may be as follows (assuming comma as field separator):
a,b,c
d,,
"this is not a separator: ,", this is a "" in a quoted string", spaces may also be part of the field value
,, "spaces around a quoted string may also be taken as part of the filed value" ,
There may even be a new-line in a field, typically in a quoted string.
If you aim to read any CSV file that was produced by any kind of program, then you have to employ a proper CSV parser. That parser would take care of all the special cases as well as of removing and un-escaping quote characters, etc.
If you have the production of the CSV file under your full control, then you know how you may simplify the general purpose CSV grammar for your needs, e.g. by asserting that no separators nor newlines nor quotes are ever part of your fields and that all fields have content, etc. If the second case is given, you may employ the simple
string.Split
function.
Cheers
Andi