Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to convert a string like s=" 1 2 3 4 5 6 7 8 9 "into an integer array a={ 1, 2, 3, 4, 5, 6, 7, 8, 9,}
How to convert a string like s=" 1 2 3 4 5 6 7 8 9 "into an integer array a={ 1, 2, 3, 4, 5, 6, 7, 8, 9,}
String I = " 1,2,3,4,5,6,7,8,9,0 ";

//Split the string into an array of strings

String [] ARR = i.split(",");

//Defines the size of the string array.

integer int array[]arr 2 = new int[arr . length];

//Convert string array values into int and put them into int array.

(N = 0, N< array length, N++){

Arr2 [N] = integer. ParseInt function (arr [n]);

}