Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Error in java string Integer.parseInt ()
Error in java string Integer.parseInt ()
Enter the last ending identifier of the string (usually a carriage return). To convert a string to int type, you must remove the last character!

Method 1: operate StringBuffer.

In strb.append(ch); add:strb . delete(strb . length()- 1,strb . length());

Method 2: the operation string intercepts the string.

Add s = s.substring (0, s.length ()-1) after s;

Both ways can be used, of course, there are other ways, I hope I can help you!