I want to add padding to left and right of my string and print something like:
| WELCOME TO THE GAME |
I am trying this:
System.out.printf("|%15s%20s|%n",header,"");
and the output is:
|WELCOME TO THE GAME |
I have 2 questions here:
- Any better way to do padding both left and right of my keyword without actually using an empty string?
- What would be the right formatting to get the desired output?