Skip to content

Finding and Reading a specific line

Steve Cordon

Asked Feb 8, 2010, 5:09 AM EST1 answer
Share
LinkedInX
Hi,

I'm in need of assitance, I've been working on what must be a simply problem for far too long and I'm just making it more complicated!!

I have a log file which I need to scan for the word "Finished" this word only appears at the beginning of a line. I have done this and stored in an array all the locations of the word Finished using Log.IndexOf("Finished") etc. This is working fine.

What I now need to do to seperate that line into a different string. so I can have CurrentLine = "Finished.... "

This is where I am now stuck. I have tried calculating line length using a FileReader but I originally read the file with a StreamReader. From here I just complicate matters. Could somebody please assist in extracting the found line into a seperate string?

Many, many thanks!

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Ok I have it. log.Substring!! I knew that exsisted just completly forgot!!
    0