Converting a string of integers to an array/arraylist

  • Thread starter Thread starter Graeme Downes
  • Start date Start date
G

Graeme Downes

I have a string of integer, such as the following:

"12 24 12 9 2"

and I want to convert this into an array or arraylist which will
seperate the string into an array of integers.

How do I do this
 
A way to go could be to use the Split() method of the string class. This
returns an array of string where each element will contain one number
(represented as string). Then you could convert them using int.Parse() and
fill them into an array of int.

José
 
Back
Top