I have a string object that is something like:
string test = "
[3, 4, 8, 10, 10]\n[12]\n[12, 10,\n 20]
"
And am trying to parse it into the 3 separate arrays equaling [3, 4, 8, 10, 10], [12], and [12,10, 20]. I have parsed Comma separated integers into an array before but how do I go about parsing this one. Unfortunately the data I have can have newlines mid array otherwise I would use the "getline" function(when reading the file into the string) and simply ignore the brackets.
It seems like I need to first get each array into its own string delimited by brackets, and then parse each of those by comma delimination into an array of integers. Would this work?
If so, how do I split up the string by brackets into a previously unknown number of other strings?