Reputation: 7733
I want to align the number on the string like that:
3 x 89 kg
3 x 133 kg
I use this format:
String.format("%1$3d x %2$3d kg", nb, weight);
But the result is not correct:
Upvotes: 4
Views: 62
Reputation: 1399
This happens due to the font(because the characters don't have the same width) Change the font to a monospaced font and the problem will be solved(I recommend Consolas font for this)
Upvotes: 1