Jump to content

How to get a certain line from a string


Recommended Posts

So i have a big string and i need to search for a certain sentence in it. Then i need to get the line number in which this sentence was found and copy that entire line into another variable.

I see that StringInStr gives me the position/number of chars where that substring is located. But i need a line number and a way to get that entire line. Is there a way to do this? Thanks, help greatly appreciated.

Link to comment
Share on other sites

So i have a big string and i need to search for a certain sentence in it. Then i need to get the line number in which this sentence was found and copy that entire line into another variable.

I see that StringInStr gives me the position/number of chars where that substring is located. But i need a line number and a way to get that entire line. Is there a way to do this? Thanks, help greatly appreciated.

if you're reading in from a file, you could just use _FileReadToArray() and then check each element for the text and the index would be your line number
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...