Length of an array after split?

Leen

Registered User.
Local time
Today, 03:47
Joined
Mar 15, 2007
Messages
56
Hi,

How do you know how many substrings an array contains after using split?

My code needs the number of elements as it has to peform some actions on that:
Code:
Function findexpression(inputvalue As String, inputexpression As String) As Boolean 'In case the rules is a regular expression, the check is done on the regular expression (landmarks-layer)

Dim arrayinputvalue
Dim previousvalue As Variant

arrayinputvalue = Split(inputexpression, ",") 'returns an array containing a specified number of substrings
previousvalue = ""

For i = 0 To i = numberofvaluesinarrayinputvalue
    If arrayinputvalue(i) < inputexpression And arrayinputvalue(i) <> previousvalue Then
        findexpression = True
    Else
        findexpression = False
    End If
    previousvalue = arrayinputvalue(i)
Next i

End Function

But how can I know "numberofvaluesinarrayinputvalue"?

I don't find any property that contains that..

Thanks!
 
use the Ubound function

Ubound(YourArrayHere) will return the upper boundry of the first dimension of the array, if you have a multi dimension array you can get the 2nd, 3rd or whatever element boundry by using Ubound(YourArray,ElementNumber)
 
Thanks!! It works!
 

Users who are viewing this thread

Back
Top Bottom