tjomasofmine
tjomasofmine

Reputation: 1

comma separated text into different arrays

(VB.net)

I have A comma separated text that looks like this text file .

What I want is to make it so each line is its own array, so one array would have "name","password","255","255","0" and another would have "name","password","255","0","255".

I've got it reading fine and I can put it into one array it's just splitting them that's the problem. Is there also a way to make the program dim the arrays themselves. For example if there are three lines then have it dim three separate arrays. Any help would be great.

Upvotes: 0

Views: 114

Answers (1)

Mark
Mark

Reputation: 8160

Using LINQ and String.Split:

Dim records As String()() = (
    From line As String In File.ReadLines(data)
    Select line.Split(","c)
).ToArray()

Upvotes: 0

Related Questions