publicclassTest { publicstaticvoidmain(String[] args) { Stringstr="0001234"; ints1=Integer.parseInt(str);//该方式仅适用于数字字符串System.out.println(s1); Strings2=str.replaceFirst("^0*", ""); System.out.println(s2); Strings3=str.replaceAll("^(0+)", ""); System.out.println(s3); } }