Do not be shy about using arrays, they are not hard to use.

   Dim people(2) As String
   people(0) = "John Henry"
   people(1) = "Catherine Weaver"
   MsgBox UBound(people)
   'access the first element in the array
   MsgBox people(0)

The split() function will make arrays to play with. For this example we are going to use split(string) and split(string, delimiter). The function returns an array of strings or string if it can not find the delimiter.

Dim myarray() as string
Dim mytext as string
Mytext = "the big red dog sat on the hill"
Myarray = split(mytext)
Dim index as integer
Index = 0
Dim output as string
Output = ""
For index to ubound(Myarray) -1
   Output = output & "index:" & index & " " & myarray(index)
Next index
Msgbox output


Leave a Reply

Your email address will not be published. Required fields are marked *