例如,如何比较两个数组的值以检查1个数组是否没有另一个数组的元素-
array1(0) = 85
array1(1) = 459
array1(2) = 90
array2(0) = 459
array2(1) = 90
我想返回第二个数组中不存在的值?我尝试使用double for循环,但对我而言效果不佳。
最佳答案
Dim array1(3)
Dim array2(2)
array1(0) = 85
array1(1) = 459
array1(2) = 90
array2(0) = 459
array2(1) = 90
Dim i 'As Integer
Dim j 'As Integer
Dim isFound 'As Boolean
For i = 0 To UBound(array1) - 1
isFound = False
For j = 0 To UBound(array2) - 1
If array1(i) = array2(j) Then
isFound = True
End If
Next 'j
If Not isFound Then
Response.Write array1(i) & " not found<br />"
End If
Next 'i