Need to split a String into an ArrayList

J

Jay B. Harlow [MVP - Outlook]

Jack,
Have you tried using String.Split to split the string into an Array, then
add the Array to the ArrayList.

Something like:
Dim values As String = "1,34,54,123,34"
Dim list As New ArrayList
list.AddRange(values.Split(","c))

Note: the ","c is a character literal, where as "," is a string literal.
They both contain a single comma.

Hope this helps
Jay
 
J

jack

Thank you very much for your help!!!!!


Jay B. Harlow said:
Jack,
Have you tried using String.Split to split the string into an Array, then
add the Array to the ArrayList.

Something like:
Dim values As String = "1,34,54,123,34"
Dim list As New ArrayList
list.AddRange(values.Split(","c))

Note: the ","c is a character literal, where as "," is a string literal.
They both contain a single comma.

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top