I have the following String:
"(X,Y,Z),(A,B,C),(R,S,T)"
I want to split this into a multi-dimensional array:
arr[0] = [x,y,z]
arr[1] = [a,b,c]
arr[2] = [r,s,t]
so that:
arr[0][1] = y, arr[0][2] = z, etc.
I can do it by stripping the first and last parens, splitting on “),(” and then looping through that array and doing another split. But I feel dirty, unpure, like a stripper (pun intended) in a backalley bar … is there a cleaner way?
Maybe some LINQ to the rescue?
I’m using C#.
1 Answer