Link to home
Start Free TrialLog in
Avatar of alexsilcock
alexsilcock

asked on

Finding out the length of an array created using Split()

Hi,

I have got a string which has a list of filenames in it separated by commas, and I have split the string into an array using the Split() function in VB6. As it happens, the string is filled with the list at run time, so I don't actually know how many items the array will have in it. Here is my code so far:

Dim thearray
Dim somestring As String
somestring = "DSC00000.JPG,DSC00001.JPG,DSC00002.JPG"
'The above line isn't actually in the code, because if it was I wouldn't have a problem. Instead, the above line would be replaced with a chunk of code to open a text file and get the contents and put them in the string.
thearray = Split(somestring, ",")

I need a way of finding out how many items are inside the array, so that I can write a loop that iterates through the array and uses each individual filename for a purpose. This should be quite a simple question to answer, and any help would really be appreciated.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
NumOfStrings=Ubound(thearray)+1