Need to split a String into an ArrayList

  • Thread starter Thread starter jack
  • Start date Start date
J

jack

Hello,

I need to plit: "1,34,54,123,34"

Into an array list.

Thanks for any help,

Jack
 
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
 
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

Back
Top