去除字符串前面的0 one:字符串转整形String tempStr = "0000123"; int result = Integer.parseInt(tempStr); two:字符串替换String str = "0000123"; String newStr = str.replaceFirst("^0*", ""); System.out.println(newStr);three:
one:字符串转整形 String tempStr = "0000123"; int result = Integer.parseInt(tempStr); two:字符串替换 String str = "0000123"; String newStr = str.replaceFirst("^0*", ""); System.out.println(newStr); three:同样字符串替换 String str = "0000123"; String newStr = str.replaceAll("^(0+)", ""); System.out.println(newStr);