此代码必须验证 findActions() 方法的输入数据:
try {
System.out.println(findActions(lookingArea.substring(0, right)));// always printing valid number string
Integer.parseInt(findActions(lookingArea.substring(0, right)));// checking for number format
}
catch(NumberFormatException exc) {
System.out.println(exc);
}
但我总是java.lang.NumberFormatException: For input string: "*number*"
觉得这很奇怪,因为检查System.out.println(findActions(lookingArea.substring(0, right)));
,
我得到*number*
像 10.0