• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

word wrapping

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai all,
can any one give me a solution for string wrapping.actually my problem is.....
i have a string with,lets suppose some 30 characters(spaces included).i need to wrap the string at a maximum length of suppose 10 characters per line(spaces included)and if there is character at the 10th position of line it should wrap at the space before that word.
can anyone givwe some solution to this....
here i am taking input from command line and i want to print the output on console.(i dont want to use swings and awts etc...).
thanks
raghu
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's something quick you can try.

[ January 13, 2004: Message edited by: Angel Dobbs-Sciortino ]
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've done something similar with a requirement to store lines instead of going right to stdout

This leaves an extraneous blank on the end of hte line. You might want to trim that first.
 
reply
    Bookmark Topic Watch Topic
  • New Topic