String格式化

String格式化输出:

    使用String类format()

    1:数字前面补全0

         String.format("%04d",88)                       输出:0088

    2:左对齐

         System.out.printf("|%-4d|",88)                输出:|88  |

猜你喜欢

转载自845642761.iteye.com/blog/2291598