[Solved] getting an error numberFormatException for invalid :int ” here it prints the phonenumbers””


this is what you try to parse:

"+91 72072 21721 +91 79 8105 5662 "

step one, perform a .split("\\+");
on your String, it will actually split it in the seperate numbers.
Next, remove all the spaces of the number you try to parse, so you’ll end up parsing

"917207221721" and "917981055662"

This will bring you a lot closer, but you should know that these numbers exceed the maximum value of int’s, so you should opt for another numerical type.

long number = Long.parseLong(input);

should be sufficient (with input being your seperate String variables).

11

solved getting an error numberFormatException for invalid :int ” here it prints the phonenumbers””