MarBobley Posted July 6, 2008 Posted July 6, 2008 hi i want to split an text at every line or at "<TR>" and then give out a line were i found a string by stringinstr. but my code doesnt work :-( #include <Array.au3> $text = "<TR><TD><A class=player>Geber: </A>cissou13360 setzt 6</TD></TR><TR><TD><A class=player>Geber: </A>massimo3347 erhöht auf 12</TD></TR><TD><A class=player>Geber: </A>lastman64 geht mit bei 12</TD></TR><TR><TD><A class=player>Geber: </A>kabilos geht mit bei 12</TD></TR><TR><TD><A class=player>Geber: </A>Maris333 passt</TD></TR><TR><TD><A class=player>Geber: </A>andrewcaldw geht mit bei 12</TD></TR><TR><TD><A class=player>Geber: </A>cissou13360 erhöht auf 18</TD></TR>" StringReplace($text,"<TR>","|") $textarray = StringSplit($text,"|") MsgBox(0,"",$textarray[0]) _ArrayReverse($textarray) For $i = 0 To UBound($textarray) - 1 Step + 1 If StringInStr($textarray[$i],"massimo") = 1 Then MsgBox("0","",$textarray[$i]) ExitLoop EndIf Next
Developers Jos Posted July 6, 2008 Developers Posted July 6, 2008 (edited) Your StringInstr() test tests for the word "massimo" starting on position 1, not anywhere in the string. Your test should be: If StringInStr($textarray[$i], "massimo") > 0 Then or If StringInStr($textarray[$i], "massimo") Then also this line should be: $text = StringReplace($text, "<TR>", "|") Jos muttley Edited July 6, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now