java - Convert String to Int with Integer.parseInt don't works -
i'm working javaee need convert this: request.getparameter("id") int . value of request.getparameter("id") "9" ( string ). when i'm trying convert int have java.lang.numberformatexception i've tried java.lang.integer.parseint(request.getparameter("id")) , request.getparameter("id",10) donsen't works... any solutions? thank you. a complete full proof code be string idstring = request.getparameter("id"); if(idstring != null) { try { system.out.println(idstring.trim()); // print verify int idint = integer.parseint(idstring.trim()); } catch(numberformatexception nbe) { nbe.printstacktrace(); } }