I have a text file that looks like this
- 1234567891
- a12b13c14d
- 2122232425
- 3132333435
- 4142434445
- 5152535455
- 6162636465
- 7172737475
- 8182838485
- 9192939495
in a N x N grid. using c# I need to take the text file and turn it into a 2d array of string so that I can manipulate each character on an independent level. Please help.There is no blank between characters.
String input = File.ReadAllText( @"c:\myfile.txt" );
int i = 0, j = 0;
string[,] result = new string[10, 10];
foreach (var row in input.Split('\n'))
{
j = 0;
foreach (var col in row.Trim().Split(' '))
{
result[i, j] = int.Parse(col.Trim());
j++;
}
i++;
}
I tried this but there is no spaces between characters. So, I'm thinking about this.