可以使用 str = str.replaceAll(“^0+”, “”);可直接使用integer.parseInt 方法,强转int实现去0; 注意:第二种方式实现时因int类型最大支持1999999999,会报错 将上面的integer.parseInt 换为Long.parseLong即可