• 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

Breaking up long sections of text

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys. I have long paragraphs of text and I want to make it so after a few lines it asks...press any key to continue..etc. I tried creating a new scanner instance but that didnt work. Is there any way to do this, or is there a java util that already does it?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're going to have to provide more details than that.

For now I'll just take a wild guess and suggest you pipe your output to the "more" command, which exists in Windows and Unix varieties at least:
 
brent carter
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
basically, i just have System.out.println("AND A WHOLE LOTTA TEXT HERE \n AND HERE \ n AND HERE\n\n\n\n\n\n"); In the console it all comes out in a massive blob and i want to break it in to sections, so after 2 or 3 sentences the user has to press a key to continue reading the text. I want to do this without writing massive input codes everywhere, I guess i could just write a class to do it for me. just wondering if anyone else did it first
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then piping to "more" is exactly what you want.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using “more” is more difficult than we usually get on “beginning”. Moving discussion.
 
reply
    Bookmark Topic Watch Topic
  • New Topic