Java Format Flags
In this chapter you will learn:
Description
Flags that controls various aspects of a conversion. All format flags are single characters and follow the % in a format specification.
Flag List
The flags are shown here:
Flag | Effect |
---|---|
- | Left justification |
# | Alternate conversion format |
0 | Output is padded with zeros rather than spaces |
space | Positive numeric output is preceded by a space |
+ | Positive numeric output is preceded by a + sign |
, | Numeric values include grouping separators |
( | Negative numeric values are enclosed within parentheses |
Next chapter...
What you will learn in the next chapter:
- How to justify Output
- Syntax for justify
- Example - left-justifies a floating-point number with two decimal places
- Example - Use Formatter to left-justify strings within a table
- Example - Use Formatter to vertically align numeric values
- How to right and left align strings
Java Formatter Class
Java Format Specifier
Java Format Specifier Uppercase
Java Format Precision
Java Format Negative and Positive
Java Format Line up Space
Java Format Parentheses
Java Format Zero Padding
Java Format Comma
Java Format Alternate Conversion
Java Format Argument Index
Java Format date time
Java Format Date
Java Format Specifier
Java Format Specifier Uppercase
Java Format Precision
Java Format Flags
Java Format Justifying OutputJava Format Negative and Positive
Java Format Line up Space
Java Format Parentheses
Java Format Zero Padding
Java Format Comma
Java Format Alternate Conversion
Java Format Argument Index
Java Format date time
Java Format Date