Jump to content

String Search


GAM
 Share

Recommended Posts

Hi, How can I search a string from a txt file separated by the char "|"? .....I will give an example, SourceFile.Txt has the following info

abqwec1|Check1|StandardTest1

hbqwec2|Check2|StandardTest2

rbqweqc3|Check3|StandardTest3

3bqwetc4|Check4|StandardTest4

ertybc5|Check5|StandardTest5

in the above file, the first line comprises of three strings abqwec1, Check1 and StandardTest1 each separated by the char "|".

How can I find the strings in order, I mean, find the first string in the first line and then the second string in the first line and the third string in the first line NOW After this, find the first string in the second line and then second string in the second line and so on and so forth till the end of the file.?

Can any one please look into this and send me an answer how to implement this is AUTOIT? Its urgent!!!

Neil

Link to comment
Share on other sites

I'm not sure what you mean by "find".

You can do this easily with _FileListToArray, StringSplit, and StringInStr in less than 10 lines of code.

hi,

Like so?

#include<array.au3>
Local $aNow[5] = ["abqwec1|Check1|StandardTest1", "hbqwec2|Check2|StandardTest2", "rbqweqc3|Check3|StandardTest3", "3bqwetc4|Check4|StandardTest4", "ertybc5|Check5|StandardTest5"]
Local $aNew[15],$k
For $i = 0 To UBound($aNow) - 1
    local $aRow=StringSplit($aNow[$i],"|")
    For $j = 1 To UBound($aRow) - 1
        $aNew[$k ] =$aRow[$j]
        $k+=1
    Next
Next
_ArrayDisplay($aNew, "$aNew"

Randall

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...