作者:为佐殿回来而读书的天使 | 来源:互联网 | 2023-05-19 12:42
Howdoyouleftpadanintwithzerosinjavawhenconvertingtoastring?在转换为字符串时,如何在java中以0作为0?
How do you left pad an int with zeros in java when converting to a string?
在转换为字符串时,如何在java中以0作为0 ?
I'm basically looking to pad out integers up to 9999 with the leading zeros (e.g. 1 = "0001").
我基本上是想用前导零(例如,1 = "0001")来填充整数到9999。
12 个解决方案