开发者

Java equivalent of: String.format("{0:D9}", Result);

Does anyone know the Java equivalent of the C# format of:

String.format("{0:D9}", Result);

Here 开发者_开发知识库what it does: http://www.java2s.com/Code/CSharp/Data-Types/doublenumberformat0C0D90E0F30N0X0x.htm

This little problem is killin' me...


As far as I understand the documentation D9 means "format as a decimal number with at least 9 digits, left-padding with 0 if necessary).

The equivalent in Java format Strings would be %09d:

System.out.println(String.format("%09d", 1234));

This prints

000001234
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜