Jump to content
Sign in to follow this  
mladost1

String Line

Recommended Posts

mladost1

I was wondering when i use String to find a certain word if I could find out which line this word was found on. Simple as that. :)

Thanks

Share this post


Link to post
Share on other sites
Paulie

When you use String?

You mean StringInStr() ??

#Include <file.au3>
$StringToSearchFor = "Monkey"
$FilePath = @DesktopDir&"\Test.txt"
Dim $Array
_FileReadToArray($FilePath, $Array)
For $i = 1 to $Array[0]
 If StringInStr($Array[$i], $StringToSearchFor) then
   Return $i
 EndIf
Next

Share this post


Link to post
Share on other sites
mladost1

I meant StringRegExp :) Your script works fine thanks a lot :)

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  

×