This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes print a string across multiple lines Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "print a string across multiple lines" Watch "print a string across multiple lines" New topic

print a string across multiple lines

madhoo vavila

Joined: Feb 20, 2004
Posts: 3
I am trying to print a string across multiple lines. Each line has 23 characters. The string will be appended to an email

emessg.append (title.substring(0,23)).append("\t\t"); //this prints the first line , and I will add something after that

But the real problem is here
int i=0;
int j=23;

The code works fine but the string is not getting wrapped up.
Suppose if I have a word "World" at the end it is printed as
But I need the word in the same line.
How do I do this? Any suggestions
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Try looking at this...

Or this...

The moral? Google is your friend.
[ July 06, 2005: Message edited by: Steve Morrow ]
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17249

Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it


Thanks! and welcome to the JavaRanch!


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: print a string across multiple lines
Similar Threads
Line Feed Carriage Return problem
Why the result of printing out the not-letter chars to console is different from to applets
Scanning a text file
Addind a word in the String
Java regex search. ".*" macther.find() or matcher.replaceAll, give more matches than intended