If I enter data into an excel spreadsheet and export it as a CSV, every comma-delimited string inside a cell will be grouped together in parenthesis, as in “cell1A,cell1B”, cell2, cell3 etc. Since CSVs import as textassets, I start with the entire document formatted as a single string. I can break it into lines with string.split, and I can likewise split it with commas to get individual fields, but splitting “cell1A,cell1B” with a comma results in two strings: "cell1A and cell1B". Is there a simple way to strip everything inside the parentheses and dump it into a single string, or would I be looking at iterating across the entire file char-by-char looking for a quotation mark, then manually adding every char after the first quote, until it hits a second quote, into a single string?
Would this help? NuGet Gallery | CsvHelper 33.0.1
Basically I’d spend time googling for a CSV parser first before reinventing the wheel.
Why not just use some sort of existing parser instead of trying to create your own?
https://stackoverflow.com/questions/2081418/parsing-csv-files-in-c-with-header
List several possible options.
@BlackPete beat me to it. I did see csvHelper in the list. And a few other options.
And to add here is something on the asset store. Not sure if it’s useful Unity Asset Store - The Best Assets for Game Making
Ooh I hadn’t even considered just using a third-party parser, that’s a great idea. ![]()