MyEarth Posted February 13, 2016 Posted February 13, 2016 (edited) Hi, i want to know if a word from an array, the second, is present in another array, the first. I have made this: Local $A1[5] = ["My phrase", "Another one word", "I hate arrays", "Autoit is cool"] Local $A2[3] = ["Word", "Autoit"] For $x = 0 To UBound($A2) - 1 For $y = 0 To UBound($A1) - 1 ConsoleWrite($a2[$x] & " " & $a1[$y] & @CRLF) If StringInStr($A1[$y], $A2[$x]) Then MsgBox(0, 0, $A2[$x] & " is in the phrase: " & $A1[$y]) EndIf Next Next Seems work but...if you check the ConsoleWrite there are some "unnecessary" ( i don't know how to exaplain ) entry, for example: CW: A 1 CW: A 2 CW: A 3 CW: A 4 CW: A ??? CW: B 1 CW: B 2 CW: B 3 CW: B 4 CW: B ??? CW: 1 ??? CW: 2 ??? CW: 3 ??? CW: 4 ??? CW: ??? It do 15 passages and in this 15 passages 7 are unnecessary, since i want always the best speed i think can be improved in some way? I think he need to check 8 times and not 15, A 1 A 2 A 3 A 4 and B 1 B 2 B 3 B 4 Thanks Edited February 13, 2016 by MyEarth
alienclone Posted February 13, 2016 Posted February 13, 2016 Local $A1[4] = ["My phrase", "Another one word", "I hate arrays", "Autoit is cool"] Local $A2[2] = ["Word", "Autoit"] For $x = 0 To UBound($A2) - 1 For $y = 0 To UBound($A1) - 1 ConsoleWrite($a2[$x] & " " & $a1[$y] & @CRLF) If StringInStr($A1[$y], $A2[$x]) Then MsgBox(0, 0, $A2[$x] & " is in the phrase: " & $A1[$y]) EndIf Next Next If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version
MyEarth Posted February 13, 2016 Author Posted February 13, 2016 Damn the size of array! What i n00b i am, thanks
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