0

Why i can't convert string to int in this code !! Some help please

https://code.sololearn.com/cKGD2jQ9OIN1/?ref=app

19th May 2021, 12:41 PM
‎Abdul Jalil
‎Abdul Jalil - avatar
2 Respostas
+ 2
Line 9: String[] arr = str.split(""); Line 17: list.add(i); I think you may also need to check whether each String array <arr> element was a digit, otherwise you'd end up with conversion error(s) trying to convert non numeric String into an integer.
19th May 2021, 1:13 PM
Ipang
+ 1
I added the trim() function in the input and it works fine Thanks a lot
19th May 2021, 1:45 PM
‎Abdul Jalil
‎Abdul Jalil - avatar