Jump to content

Array Comparison


torels
 Share

Recommended Posts

Hi there

Is there a way to compare 2 arrays (Possibly using a different way than _ArraySearch)

I thought of sorting them and then compare every single index but as soon as you get a mismatch, the whole thing stops working

tanks in advance

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

I havn't got a script.

I was just trying to see if there are better ways of comparing a script than using _arraysearch

my idea was to use the biggest array of the 2 (one array always has all the other array's values in it) and do an _arraysearch...

in case of error then add that value to the list of missing ones in the other array

Edited by torels

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

Func _Compare($aArray1, $aArray2)
    Dim $Result[1]
    $aMaxArray = _MaxArray($aArray1, $aArray2)
    $aMinArray = _MinArray($aArray1, $aArray2)
    For $i = 0 To UBound($aMaxArray)-1
        _ArraySearch($aMinArray, $aMaxArray[$i])
        If @error Then _ArrayAdd($Result, $aMaxArray[$i])
    Next
    
    Return $Result
EndFunc
    
Func _MaxArray($aArray1, $aArray2)
    If UBound($aArray1) > UBound($aArray2) Then
        Return $aArray1
    Else
        Return $aArray2
    EndIf
EndFunc

Func _MinArray($aArray1, $aArray2)
    If UBound($aArray1) < UBound($aArray2) Then
        Return $aArray1
    Else
        Return $aArray2
    EndIf
EndFunc

here is what I have

Is there a better way of doing it ?

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

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