Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

truncate string to 10 characters padding with whitespaces if < 10 chars

843829Feb 7 2006 — edited Oct 31 2007
Hi im trying to truncate string to 10 characters padding with whitespaces if < 10 chars to give the folowowing results

OK : trimTo10( "Hit" ) your answer is -> "Hit "
OK : trimTo10( "1234567890123" ) your answer is -> "1234567890"
OK : trimTo10( "" ) your answer is -> " "


can anyone give me the correct code to do this? I need to hand this in as coursework V SOON!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 28 2007
Added on Feb 7 2006
8 comments
373 views