I have a text file that I'm searching through and I want to skip the 10 first characters in every line.
Each line starts with [10:16:01], thats what I want to skip and I want to find the next number in the line and add the numbers together.
This is what I've managed to do so far
foreach (string line in lines)
{
string a = line.Remove(0, 10);
if (a.Contains("whateverimsearchingfor"))
{
string resultString = Regex.Match(a, @"\d+").Value;
int result = Int32.Parse(resultString);
total += result
}
Thanks in advance!
Sorry when I try and build I get:
ArgumentOutOfRangeException was unhandled index and count must refer to a location within the string
It points to the string a = line.remove(0, 10)
Hope this is enough.