Haraakesh Kumar

Haraakesh Kumar

  • NA
  • 2
  • 8.3k

Convert string to X-dimensional array

Nov 30 2012 1:57 AM
Hello! 
How do I convert a string, formatted as following:

string str="1 2 3 4;5 6 7 8;9 10 11 12;13 14 15 16"

to a multidimensional array, so that:

arr[0,0]=1
arr[0,1]=2
arr[0,2]=3
arr[0,3]=4
arr[1,0]=5
and so on.

The string can have different sizes.
Thanks!

Answers (2)