The string looks like a 2-D array:
[['a;b;c','d','e'],['a;b;c;d','h','k'], ... ]
But how do i evaluate it and transform it into 2D array in C# without using Split()?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you have a programming problem and you are stuck, break it down into a simpler programming problem. This answer will show you how to crudely parse using only C# string primitives just one “sub-array” of your string into a list. That would be good progress and then you can start extending and improving the code.
This produces as output:
It’s not two-dimensional but I’m not going to write your whole program for you. It’s also puts it into a
Listinstead of an array, but you have to do that anyway because you don’t know how big it is. This is what I mean by breaking the problem down into smaller parts that you can solve.You can also improve the code by considerable error-checking for missing commas, etc. But this should get you started.