user3654442 user3654442 - 1 year ago 54
Vb.net Question

Converting strings into an int array in visual basic?

Lets say I have a string like this:

"1,2,5,8"


How can I make a function in VB to turn that into an array of ints?

Answer Source

First split the string with the comma as separator and then convert each element in that resulting array into integer.

Dim ints = Array.ConvertAll("1,2,5,8".Split(","c), AddressOf Convert.ToInt32)