public static Integer StringToInt(String str){
str=str.trim();
String str2="";
if(str !=null&&!"".equals(str)){
for(int i=0;i<str.length();i++){
if(str.charAt(i)>=48 && str.charAt(i)<=57){
str2+=str.charAt(i);
}
}
}
return Integer.valueOf(str2);
}
通过这个方法就可以对字符串中的数字进行抽取,然换成整数类型,大家就可以直接使用了