user3654442 user3654442 - 1 year ago 85 Question

Converting strings into an int array in visual basic?

Lets say I have a string like this:


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)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download