How to covert 2d string array to 2d integer array? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 1

How to covert 2d string array to 2d integer array?

suppose if give input as- {"1","2","3" "4","5","6"} then output will be like- {1,2,3 4,5,6}

3rd Apr 2018, 2:21 PM
Nikhil Kohli
Nikhil Kohli - avatar
1 Resposta
+ 2
Create an empty 2D array to receive the integers. Now, go through the original 2D array and then use Integer.parseInt(element_of_the_array) on each element and put the integers in the new array... This is for Java In Python, you can do the same. You will just have to replace Integer.parseInt() by int(....)
3rd Apr 2018, 2:26 PM
cyk
cyk - avatar