开发者

Java Formatter - what is '#' for?

According to javadoc, the '#' flag stan开发者_开发技巧ds for "The result should use a conversion-dependent alternate form". I wasn't able to find any details on that. Could someone explain what is the "conversion-dependent alternate form"?


There are examples given in the javadoc.

eg for an integer being output as octal,

If the '#' flag is given then the output will always begin with the radix indicator '0'.

or as hex,

If the '#' flag is given then the output will always begin with the radix indicator "0x".

For floating-point numbers,

If the '#' flag is given, then the decimal separator will always be present.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜