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.
精彩评论