一些id标识的要求,比如数字自增,0001,0002,0003等。下面这个方法实现了这个功能:
思路:int a;a++;fillstr();
贴代码:
public class mainTest {
public static void main(String[] args) {
String outString="";
outString=fillStr("123", 9, false, "0");
System.out.println("false"+outString);
outString=fillStr("123", 9, true, "0");
System.out.println("true"+outString);
}
/**
*
* @param value
* @param count
* @param frontORback
* @param fillChar
* @return if frontORback is ture ,return the (count-value.length) fillchar added to the front of the value
* if frontORback is false,return the (count-value.length) fillchar added to the back of the value
* for instance : value="123",count=9,frontORback=true,fillchar="0"<br>
* re