String str = "sdfjsd232"; str = str.replaceAll("\\D",""); int i = Integer.parseInt(str); System.out.println(i);
将字符去掉,在转成数值型