How can I use java Integer.parseInt()?
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "00001 "
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at LibraryManager.BookAdd.getInsertOrderedList(BookAdd.java:105)
while(rs1.next()){
allid[i]=rs1.getString("id");
String mystr=allid[i].substring(1);
try{
System.out.println(mystr);//this print 00001
intofid[i]=Integer.parseInt(mystr);
}catch(Exception e){
e.printStackTrace();
}
i++;
}
how could I resolved this??
Hey Hiro ,
Here is complete solution of your problem.It is basic concept but important concept inside String.
String var ="A00001";
int vars=Integer.parseInt(var.substring(1,var.length()).trim());
Comments
Post a Comment