I have managed to split a CSV file based on the commas. I did this by placing a dummy String where ever there was a \',\' and then splitting based on the dummy String.
As per the dummy strings you mentioned, it could be easily processed with the help of an existing library. I would like to recommand the open source library uniVocity-parsers, which procides simplfied API, significent performance and flexibility.
Just refer to few lines of code to read csv data into memory with array:
private static void parseCSV() throws FileNotFoundException {
CsvParser parser = new CsvParser(new CsvParserSettings());
List parsedData = parser.parseAll(new FileReader("/examples/example.csv"));
for (String[] row : parsedData) {
StringBuilder strBuilder = new StringBuilder();
for (String col : row) {
strBuilder.append(col).append("\t");
}
System.out.println(strBuilder);
}
}