I have got column in db which saves the string as 1,2,3,4,5
I want to separate the string to 1 2 3 4 5 and save each number in the array , for instance the array should be like int [] numbers , int[0] = 1 , int[1] = 2 ……
I have got column in db which saves the string as 1,2,3,4,5 I want
Share
Looks like you want:
Obviously this will go bang if any of the split results is not a parsable integer.
(You may also want to use a
List<int>instead of an array, as a generally more flexible collection type.)EDIT: Short but complete demo program: