ConversionSpecification allows the formatting of a single primitive or object embedded within a string. The formatting is controlled by a format string. Only one Java primitive or object can be formatted at a time.
A format string is a Java string that contains a control string. The control string starts at the first percent sign (%) in the string, provided that this percent sign
- is not escaped protected by a matching % or is not an escape % character,
- is not at the end of the format string, and
- precedes a sequence of characters that parses as a valid control string.
A control string takes the form:
% ['-+ #0]* [0..9]* { . [0..9]* }+ { [hlL] }+ [idfgGoxXeEcs]
The behavior is like printf. One (hopefully the only) exception is that the minimum number of exponent digits is 3 instead of 2 for e and E formats when the optional L is used before the e, E, g, or G conversion character. The optional L does not imply conversion to a long long double.