开发者

Java Formatter - what is '#' for?

开发者 https://www.devze.com 2023-03-25 11:58 出处:网络
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 i

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

精彩评论

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