Sign in to follow this  
Followers 0
Imp3rial

autoit search

4 posts in this topic

How to find a text in another text and line of text

EX : text is

aaaaa

bbbbb

cccccc

ddddd

eeeee

and i want to find eeeee and the program say : exist on line 5

Share this post


Link to post
Share on other sites



$text_to_search = 'eeee'
$text = 'aaaa' & @CRLF & _
      'bbbb' & @CRLF & _
      'cccc' & @CRLF & _
      'dddd' & @CRLF & _
      'eeee'
$text_split = StringSplit($text, @CRLF, 1)
For $idx = 1 To $text_split[0]
   If StringInStr($text_split[$idx], $text_to_search, 0, 1) > 0 Then
      MsgBox(262144, '', $text_to_search & @CRLF & ' found on line ' & $idx)
   EndIf
Next

I hope this help you...

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Welcome,

StringSplit

For...To...Next

If...Then...EndIf

StringInStr

Should get you started :D

Check the helpfile up for them.

Cheers,

Brett

Edited by BrettF

Share this post


Link to post
Share on other sites

$string = "hefhfehfh  ruohr" & @CRLF & "rufuheyf"
$capture = "he"
$split = StringSplit($string, @CRLF, 1)
For $count = 1 To $split[0]
    If StringInStr($split[$count], $capture) Then
        MsgBox(0, '', $capture & " found at " & $count)
    EndIf
Next

hi, and welcome :D


Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

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  
Followers 0