Advertisement
Java_Volume1 VB function enhancement #89880

Is in Array Function

Find if a value exists in an array WITHOUT LOOPING. Often we need to find out if a value exists in an array. This one does it VERY FAST. NOTE: This Function only return True / False regarding the Existence of a Value. If you need the Index you will have to LOOP.

AI

AI 摘要: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

源代码
original-source
Public Function IsInArray(FindValue As Variant, arrSearch As Variant) As Boolean
 On Error GoTo LocalError
 If Not IsArray(arrSearch) Then Exit Function
 If Not IsNumeric(FindValue) Then FindValue = UCase(FindValue)
 IsInArray = InStr(1, vbNullChar & Join(arrSearch, vbNullChar) & vbNullChar, vbNullChar & FindValue & vbNullChar) > 0
Exit Function
LocalError:
 'Justin (just in case)
End Function
原始评论 (3)
从 Wayback Machine 恢复