Link to home
Start Free TrialLog in
Avatar of DTRON04
DTRON04

asked on

Looping a Split Array

I need the proper code to loop a Split Array

        Dim BSplit
        BSplit = Microsoft.VisualBasic.Split(Testing the Split, " ")

I want to split the above then loop through the array 0 1 etc.
Could someone help me out with this.
Avatar of 1209
1209

       Dim BSplit() as string
        BSplit = Microsoft.VisualBasic.Split(Testing the Split, " ")
discard the previous one....
        Dim BSplit
        BSplit = Microsoft.VisualBasic.Split(Testing the Split, " ")
for j as inetegr= 0 to upperbond(bsplit)
next
Avatar of DTRON04

ASKER

Dim BSplit      
 BSplit = Microsoft.VisualBasic.Split(BName, " ")
        For j = 0 To Upperbound(BSplit)
            BClean = BClean + "+" + BSplit(j)
        Next

This code tells me upperbound has to be declared

SOLUTION
Avatar of 1209
1209

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
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
I agree with idle mind, however I just wanted to add a quick note about performance and the For Each loop..  When you use a For Each loop, an Enumerator object is created behind the scenes.  For this reason, you should avoid For Each, and use the For loop indexing method (ie.  For i = 0 to n  etc.) when complexity/performance is a concern

KGREG
i was mentioning it wrong...its UBound and not upperbound....
SOLUTION
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
Avatar of DTRON04

ASKER

thanks guys