centralising column header
Heys guys can someone tell my why this isnt centralised and how i can centralise it

14 Replies
⌛
This post has been reserved for your question.
Hey @kkeiiii! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
This is because of the way
\t
worksi see
Because it only has 2 columns?
It more or less adds spaces until it reaches one of a few column widths
e.g. one divisible by 4
ohh
so how do i fix it
you could not use
\t
at all and use %s
with a length specifier (idk the actual name) for everything
so you specify a length for all elementsi see
or in this case, it might work if you add a
\t
before the %d
or 3 spaces
though note that the amount of space you get from \t
depends on the systemLets say i want every column to be centralised no matter the system
So if i replace /t with %s10 will that work?
then don't use
\t
well not just replacing
you would need to actually use String.format
(or similar, e.g. System.out.printf
)
and then you'd need to use the corresponding format strings with the text passed as additional argumentsgot it
thanks
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@686463497802219588>.