## Recommended Posts

i have \$array_a :-

\$array_a = a

\$array_a = b

\$array_a = c

\$array_a = d

\$array_a = e

and \$array_b :

\$array_b = b

\$array_b = d

\$array_b = e

i want to exctract \$array_b FROM \$array_a

so the results will be :-

\$array_a = a

\$array_a = c

Hope this makes sense, thanks

##### Share on other sites

How did you get the results? Makes no sense to me...

What goes around comes around... Payback's a bitch.

##### Share on other sites

EDIT: i want to DELETE \$array_b FROM \$array_a

##### Share on other sites

```#include <Array.au3>

Dim \$array_a
\$array_a = "a"
\$array_a = "b"
\$array_a = "c"
\$array_a = "d"
\$array_a = "e"

Dim \$array_b
\$array_b = "b"
\$array_b = "d"
\$array_b = "e"

Dim \$array_c = _ArrayExtract(\$array_a, \$array_B)
_ArrayDisplay(\$array_c)

Func _ArrayExtract(\$Array1, \$Array2)
Dim \$Array3, \$Found
For \$i = 0 To UBound(\$Array1)-1
\$Found = False
For \$j = 0 To UBound(\$Array2)-1
If \$Array1[\$i] == \$Array2[\$j] Then
\$Found = True
EndIf
Next
If Not \$Found Then
ReDim \$Array3[UBound(\$Array3)+1]
\$Array3 += 1
\$Array3[UBound(\$Array3)-1] = \$Array1[\$i]
EndIf
Next
Return \$Array3
EndFunc```

Couldn't think of a better name for it, but it does what you want. It returns arrays like StringSplit() does,  element is the count of the rest of the items.

##### Share on other sites

thanks i will try this in my script

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...