By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,782 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,782 IT Pros & Developers. It's quick & easy.

toString align problem

P: n/a
suppose there're three String a[], b[] and c[], the length are not fixed.
how can i make the format a[] b[] c[] so that three arrays align to the
left?

ok, i know it's stupid.. but i don't think using StringTokenizer to
implement my own format is a good idea... plez help me out, thanks a lot!

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Chen Yang" <NO****@hotmail.com> wrote in message
news:Ih*********************@news4.srv.hcvlny.cv.n et...
suppose there're three String a[], b[] and c[], the length are not fixed.
how can i make the format a[] b[] c[] so that three arrays align to the
left?

ok, i know it's stupid.. but i don't think using StringTokenizer to
implement my own format is a good idea... plez help me out, thanks a lot!


So there are three string arrays, and you want to print in columns?

Loop through each to find the longest one, then print each followed by
enough space to make them align.

I think there is a method in String that will repeat a character some number
of times.

-- glen
Jul 17 '05 #2

P: n/a
nos
be sure to use a font that has equal width characters

"Glen Herrmannsfeldt" <ga*@ugcs.caltech.edu> wrote in message
news:_UGpb.101148$Tr4.273598@attbi_s03...

"Chen Yang" <NO****@hotmail.com> wrote in message
news:Ih*********************@news4.srv.hcvlny.cv.n et...
suppose there're three String a[], b[] and c[], the length are not fixed. how can i make the format a[] b[] c[] so that three arrays align to the
left?

ok, i know it's stupid.. but i don't think using StringTokenizer to
implement my own format is a good idea... plez help me out, thanks a
lot!
So there are three string arrays, and you want to print in columns?

Loop through each to find the longest one, then print each followed by
enough space to make them align.

I think there is a method in String that will repeat a character some number of times.

-- glen

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.