字符串补零除0

//去零操作

String str = "0050580";
  

System.out.println(str.replaceFirst("^0*", ""));



//补零操作  10表示补零后字符串的长度为10



String str = String.format("%010d", 100);   
       

System.out.println(str);

猜你喜欢

转载自fulinweiyang.iteye.com/blog/2250691