1. 程式人生 > >字符串前面自動補零

字符串前面自動補零

str string %0 code clas rate nbsp sys eth

public class front0add {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        String newString = String.format("%04d",718);   
        System.out.println("newString == "+newString);  
    }

}

字符串前面自動補零