字符串可能是如下几类
+11
-11
+111.22
-111.22
"+100","5e2","-123","3.1416"和"-1E-16"
如下则不可以转成数字
12e","1a3.14","1.2.3","+-5"和"12e+4.3"
public class Solution {
public boolean isNumeric(char[] str) {
try{
Double.parseDouble(new String(str));
}catch(Exception e){
return false;
}
return true;
}
}