• Post Reply Bookmark Topic Watch Topic
  • New Topic

Breaking up long sections of text  RSS feed

 
brent carter
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • 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?
 
Paul Clapham
Sheriff
Posts: 22813
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 22813
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then piping to "more" is exactly what you want.
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using “more” is more difficult than we usually get on “beginning”. Moving discussion.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!