This is the file I would like to examine, I would like to know whether "str1" appears before "str2" in this text file:
file.txt
aaa
aa
aa
aaa
a
a
aa
str1
aa
aa
a
aaa
aa
a
aaa
aaa
aa
str2
aa
a
a
aa
aaa
...
I am looking for a good algorithm to use on a number of files containing hundreds of lines! PS I don't have source code yet, I'm still in the planing phase.
check
if(str.indexOf("str1") != -1 && str.indexOf("str2") != -1 && str.indexOf("str1") < str.indexOf("str2"))
return true;