Robb Meade wrote on 29 jun 2003 in
microsoft.public.inetserver.asp.general:
for i = 0 to ubound(ARR2)
found = "false"
for j = 0 to ubound(ARR1)
if (ARR2(i) = ARR1(j)) then
found = "true"
exit for
end if
next
if found ="false" then
strOutput=strOutput & ARR2(i) & ","
ARR2temp = ARR2(i)
end if
next
Where is ARR2temp used for ?
You need to initialise strOutput
Better use a boolean for "found"
Let me try:
strOutput=""
for i = 0 to ubound(ARR2)
found = false
for j = 0 to ubound(ARR1)
if ARR2(i) = ARR1(j) then
found = true
exit for
end if
next
if not found then
strOutput=strOutput & ARR2(i) & "<br>"
end if
next
response.write strOutput
=============================
Even so, if ARR2 has duplicates not in ARR1, they will be written
And if ARR1 has entries not in ARR2 they will not be written
Perhaps it is better to
1 delete all double entries inside each array
2 put all values in one array arr3 and
3 output all non-double entries ?
This is step 3:
for i=0 to ubound(arr3)
for j=0 to ubound(arr3)
found=false
if arr3(i)=arr3(j) and i<>j then
found=true
exit for
end if
next
if not found then
response.write arr3(i) & "<br>"
end if
next
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)