Compare two string arrays, & list non equal items only
'This will display (on separate lines) b c d g i
Dim roles As String() = {"a", "e", "f", "h"}
Dim allRoles As String() = {"a", "b", "c", "d", "e", "f", "g", "h", "i"}
Dim nextRole As String
For Each nextRole In allRoles
If Array.IndexOf(roles, nextRole, 0) = -1 Then
Response.Write(nextRole & "
")
End If
Next
Array.IndexOf Method
The method returns the index of the first occurrence of a value in a one-dimensional Array or in a portion of the Array. The method returns the index position of the first occurrence of the value if it exist. The method retuns -1 it it doesn’t exist.
lørdag 8. mai 2010
Abonner på:
Legg inn kommentarer (Atom)
Ingen kommentarer:
Legg inn en kommentar