Read text file

I have a text file with 100 lines, how do i just fetch the value that is present in the last line of .txt file? The number of lines can vary each time, but my intention is to fetch the last line always.

Hi,

Can you try the following expression?

lastLine = yourString.Split(vbCrLf.ToCharArray,System.StringSplitOptions.RemoveEmptyEntries).Last()

Regards,

2 Likes

Thanks it works :slight_smile:

Hi yoichi,

Is there any way to fetch the line with a key value, for eg in the below line
“local parameter and identifier is Snapdragon” — I need to fetch the entire line using the word Snapdragon which is the key value, each time that key value can vary and there are close to 100 lines in text file. Any way to retrieve the entire line using the key value?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.