3
【笔记】Java指定数字位数
source link: https://feiju12138.github.io/2022/07/29/Java%E6%8C%87%E5%AE%9A%E6%95%B0%E5%AD%97%E4%BD%8D%E6%95%B0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
【笔记】Java指定数字位数
2022-07-29
1
Java指定数字位数为固定的长度,如果不足,前面用0补齐
通过String
<num>
:数值
0
:要补的字符4
:字符串长度d
:整数类型
String.format("%04d", <num>);
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK