Jump to content
Sign in to follow this  
darkmaster071

How to get a certain line from a string

Recommended Posts

darkmaster071

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.

Share this post


Link to post
Share on other sites
seandisanti

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

Share this post


Link to post
Share on other sites
darkmaster071

Just what i need :blink: Thanks

Share this post


Link to post
Share on other sites
seandisanti

Just what i need :blink: Thanks

np, glad to help

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.