Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Array compare

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,37935
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Array compare
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Array compare - 9/19/2006 8:55:21 PM   
  SirBlade

 

Posts: 28
Score: 0
Joined: 1/11/2006
Status: offline
I'm trying to compare 2 arrays and get all the item that are in array1 but not in array2. So far i have no luck in finding sample code that's understandable. Does anybody i thought this would be q quite common problem since i got several scripts in mind in which i want to do this. I tried the following but that doesn't seem to work very well.


      

< Message edited by SirBlade -- 9/19/2006 9:18:54 PM >
 
 
Post #: 1
 
 RE: Array compare - 9/19/2006 10:13:37 PM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
something like:

i=0
While i < UBound(myArray)
If myArray(i) = alsoMyArray(i) Then 
  'do your thing
End If
i = i + 1
Wend






or something like:

http://www.devguru.com/technologies/vbscript/QuickRef/filter.html

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to SirBlade)
 
 
Post #: 2
 
 RE: Array compare - 9/19/2006 11:37:07 PM   
  SirBlade

 

Posts: 28
Score: 0
Joined: 1/11/2006
Status: offline
Yes! I finally made it work.


      

(in reply to Snipah)
 
 
Post #: 3
 
 RE: Array compare - 9/21/2006 11:53:18 AM   
  Skie

 

Posts: 58
Score: 0
Joined: 3/2/2006
Status: offline
A little late and it would depend on the size of your array, but this might speed it up a little by eliminating one of the loops.

      

(in reply to SirBlade)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Array compare Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts