Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String s = "0123456789";
- String result = String.format("[%1$15s]", s); //returns [ 0123456789]
- String result = String.format("[%1$-15s]", s); // returns [0123456789 ]
- String result = String.format("[%1$.5s]", s); // returns [01234]
- String result = String.format("[%1$-.5s]", s); // throws MissingFormatWidthException
- String result = String.format("[%1$-0.5s]", s); // throws MissingFormatWidthException
- String result = String.format("[%1$.-5s]", s); // throws UnknownFormatConversionException
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement