Stirng name="asdfq5asdf23"; 输出数字:523 解决方案: // 0-48 1-49 2-50 3-51 4-52 5-53 6-54 7-55 8-56 9-57 String s = "sd4f4335g67"; for (int i = 0; i < s.length(); i++) { String temp = s.substring(i, i + 1); byte[] y = temp.getBytes(); if (y[0] >= 48 && y[0] <= 57){ System.out.println(temp); } }
?