Splitting array contents

shuey79

New member
Joined
Sep 15, 2007
Messages
2
Programming Experience
Beginner
Hello,
I am a beginner at VB but have experience with Java. Anyway, I have an array of strings and its contents are:
array(0) is: a=0
array(1) is: b=0
array(2) is: c=0
and so on all the way up to letter Z....

How can I split each element into a 2d array. For instance:
array(0,0)=a
array(0,1)=0
array(1,0)=b
array(1,1)=0
and so on....

If I were doing this in java I would have used a tokenizer with different delimiters. I have read that I can use the split method but I tried it and I seem to be having trouble.

I have been trying to figure this out for like a week so any help would be greatly appreciated!!!
 
VB.NET:
Dim upperBound As Integer = arr1.GetUpperBound(0)
Dim arr2(upperBound, 1) As String
Dim parts As String()

For index As Integer = 0 To upperBound Step 1
    parts = arr1(index).Split("="c)
    arr2(index, 0) = parts(0)
    arr2(index, 1) = parts(1)
Next index
That said, I would suggest using a Dictionary(Of Char, Integer) rather than a 2D array.
 
Thats great!! It works, and its so simple. Now I feel dumb for asking the question.
I'll look into the Dictionary method. I have never used one before so I don't know anything about it. thanks very much, I really appreciate it!
 
Back
Top