I have this variable:
string coord = "[[1,2,3,4], [5,6,7,8], ...]";
And at the end I expect to be:
double[][] d = [[1,2,3,4], [5,6,7,8], ...]
Here is the code that I already tried:
double[] d = coord.Split(",").Select(n => Convert.ToDouble(n)).ToArray();
It gives me an error: System.FormatException: 'Input string was not in a correct format.' My question:
How to resolve the above error?
Is there any proper ways to do that conversion, if anyone has the pseudo-code to solve this conversion it really helps me a lot.
Update:
Here is the pseudo-code that comes in my mind:
//convert string to one-dimensional array of double
//grap every 4 elements to be put on a single array
//add a single array that consist of 4 elements to the 2-dimensional array of double.
//Verify the result