jacknbey
09-16-2005, 05:53 AM
Dear All,
I have 2 Array with huge contents, Array A (25000) and Array B (35000).
These 2 Array have only 50% in common. I need to track what is missing from ArrayA that ArrayB has and vice versa.
Any help is greatly appreciated.
Regards,
Jack
slyfox
09-17-2005, 06:56 AM
<%
var arrA = "3,4,5,6";
arrA = arrA.split(",");
var arrB = "1,2,3,4";
arrb = arrb.split(",");
var countAtrue = 0;
var countAfalse = 0;
var ATrue = false;
var holderATrue = New Array(); // got it in B
var holderAFalse = New Array(); // hasn't got it in B
for(var i = 0; i < arrA.length; i++)
{
for(var j = 0; j < arrB.lenthg; j++)
{
if(arrA == arrB)
{
holderATrue[countAtrue] = arrA[i];
countAtrue++;
ATrue = true;
}
}
if(ATrue == false)
{
holderAFalse[countAfalse] = arrA[i];
countAfalse++;
}
ATrue = false;
}
for(i = 0; i < holderATrue.length; i++)
{
Response.Write("<br>holderATrue: " + holderATrue[i]);
}
for(i = 0; i < holderAFalse.length; i++)
{
Response.Write("<br>holderAFalse: " + holderAFalse[i]);
}
%>
Now just do the same for arrB... I done this in ASP JScript, I haven't tested it yet but I'm sure it will work, I used a similar method a while ago. Just convert it to VBScript if you prefer