Compare values of two arrays - classic asp

前端 未结 3 664
北海茫月
北海茫月 2020-11-30 08:38

How can I Compare values of two arrays to check if 1 array does not have an element of another array for example -

array1(0) = 85
array1(1) = 459
array1(2)          


        
3条回答
  •  离开以前
    2020-11-30 09:08

    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
    " End If Next 'i

提交回复
热议问题