I have type strings "1\t2\r\n3\t4"and I would like to split them as:
new string[][] { { 1, 2 }, { 3, 4 } }
Basically, it should be split into rows, and each row should be tabbed. I tried using the following, but it does not work:
string toParse = "1\t2\r\n3\t4";
string[][] parsed = toParse
.Split(new string[] {@"\r\n"}, StringSplitOptions.None)
.Select(s => s.Split('\t'))
.ToArray();
- What is wrong with my method? Why don't I get the desired result?
- How do you apply this problem with LINQ?
source
share