Split multi dimension

  • Thread starter Thread starter Jan Hanssen
  • Start date Start date
J

Jan Hanssen

Hi!

I have a list of data in a textfile which is tab delimited. Each line is
seperated by a VbCrLf. I want to collect this data in a multidimensional
string array. I do not wish to use a database or a Disconnected ADO
Recordset since this is just passing data along to be written into an XML
file...

I've figured out how to split the data line by line by doing a

asSysLogLines = Split(Me.sLogText, vbCrLf, , CompareMethod.Text)
but i want to split up the data in each of this arrays field..

the data is like asSysLogLines(0) = Username <TAB> I.P <TAB> LOCATION <TAB>
Message


How can i split this up so that this becomes a multidimensional array so
that i can keep all the data in one array an easily access the fields ?

Thanks
 
Hi Jan,

See what you can do with this sample I made once, I saw you know how to
split it, so with this it should be easy.
\\\
Option Strict On
Public Module Main
' Sample of an arraylist that itself contains 10 classic arrays.
Public Sub Main()
Dim a As New ArrayList
Dim B() As Integer = {1, 2, 3, 4}
For i As Integer = 0 To 9
a.Add(B)
Next
MessageBox.Show(DirectCast(a(9), IList)(2).ToString)
'With option strict off you do not
'have to use the directcast and than it is
'MessageBox.Show(a(2)(2).ToString) 'but I would not do that
'I show this to make it more classic looking for you.
End Sub
End Module
///
I hope this helps a little bit?

Cor
 
* Jan Hanssen said:
I have a list of data in a textfile which is tab delimited. Each line is
seperated by a VbCrLf. I want to collect this data in a multidimensional
string array. I do not wish to use a database or a Disconnected ADO
Recordset since this is just passing data along to be written into an XML
file...

I've figured out how to split the data line by line by doing a

asSysLogLines = Split(Me.sLogText, vbCrLf, , CompareMethod.Text)
but i want to split up the data in each of this arrays field..

the data is like asSysLogLines(0) = Username <TAB> I.P <TAB> LOCATION <TAB>
Message


How can i split this up so that this becomes a multidimensional array so
that i can keep all the data in one array an easily access the fields ?

First determine the number of lines and columns (for example, by
analyzing the 1st line after splitting all the lines), then create the
2D-array, split the lines and insert the data into the big array.
 
Back
Top