求A∩ ̄B
求A交B的补:
<%
function RemoveFromArray(arr1,arr2)
dim arr
dim i,j,arrlen
redim arr(0)
arrlen=0
for i=0 to ubound(arr1)
for j=0 to ubound(arr2)
if arr1(i)=arr2(j) then
exit for
end if
next
if j=ubound(arr2)+1 then
redim Preserve arr(arrlen)
arr(arrlen) = arr1(i)
arrlen = arrlen + 1
end if
next
RemoveFromArray = arr
end function
myarr1=Array("aa","bb","cc","dd","eee","ff","gg","34","3434")
myarr2=Array("aa","34")
response.write (join(RemoveFromArray(myarr1,myarr2)))
%>
function RemoveFromArray(arr1,arr2)
dim arr
dim i,j,arrlen
redim arr(0)
arrlen=0
for i=0 to ubound(arr1)
for j=0 to ubound(arr2)
if arr1(i)=arr2(j) then
exit for
end if
next
if j=ubound(arr2)+1 then
redim Preserve arr(arrlen)
arr(arrlen) = arr1(i)
arrlen = arrlen + 1
end if
next
RemoveFromArray = arr
end function
myarr1=Array("aa","bb","cc","dd","eee","ff","gg","34","3434")
myarr2=Array("aa","34")
response.write (join(RemoveFromArray(myarr1,myarr2)))
%>