If we do System.out.printf("%10s", "1"); by default, the space characters will be added to fill in 10, right? Is there a way to change this?
I know, you can add 0, by specifying 0 before the s, but does printf support anything else?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Nope. Space is hard-coded. Here’s the snippet of java.util.Formatter source even:
If you’re looking to get a different padding you could do a post-format replace or something similar: