How can I use a for each loop on an array?

前端 未结 4 1545
南旧
南旧 2020-12-07 15:19

I have an array of Strings:

Dim sArray(4) as String

I am going through each String in the array:

for each element in sarray         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-07 16:17

    what about this simple inArray function:

    Function isInArray(ByRef stringToBeFound As String, ByRef arr As Variant) As Boolean
    For Each element In arr
        If element = stringToBeFound Then
            isInArray = True
            Exit Function
        End If
    Next element
    End Function
    

提交回复
热议问题