Java提取字符串中的数字
// 获取字符串数字 private static void stringNumber() { String a = "20kg/桶"; String dest = "0"; if (a != null) { dest = a.replaceAll("[^0-9]", ""); } System.out.println(dest); }
// 获取字符串数字 private static void stringNumber() { String a = "20kg/桶"; String dest = "0"; if (a != null) { dest = a.replaceAll("[^0-9]", ""); } System.out.println(dest); }