Looking for a good way to parse this text file, the values are highlighted in yellow with C #. Each section is indicated by TERM #, which I forgot to highlight. Tried this:
string fileName = "ATMTerminalTotals.txt";
StreamReader sr = new StreamReader(fileName);
string[] delimiter = new string[] { " " };
while (!sr.EndOfStream)
{
string[] lines = sr.ReadLine().Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
foreach (string line in lines)
{
Console.WriteLine(line);
}
}
Console.ReadLine();
It is safe to say that I read the lines correctly and remove the "spaces". Although, as a programming lover, I’m not sure of the right way to “know” for sure that I get the values from this report that I need. Any advice?
Shawn source
share