Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-13-2010, 04:32 AM   PM User | #1
RocketmanJP
New to the CF scene

 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
RocketmanJP is an unknown quantity at this point
Formatting Help

I have to make a bibliography formatter and I got everything to work perfectly expect one part; when creating the APA formatting it requires you to split the title of the book onto two lines if it's a long title and also have it tabbed. For example this is what i'm talking about:

Okuda, M., & Okuda, D. (1993). Star trek chronology: The history

of the future. New York, NY: Pocket Books. (for some reason i cant get the tab to show up)

The title of the book is Star trek chronology: The history of the future which is one variable (title) how do you set the length of the line so that it is only so long and then continue tabbed over on the next line is basically what i'm trying to figure out?
RocketmanJP is offline   Reply With Quote
Old 04-13-2010, 07:55 AM   PM User | #2
servlet
Regular Coder

 
Join Date: Jan 2009
Location: india
Posts: 145
Thanks: 0
Thanked 5 Times in 5 Posts
servlet is an unknown quantity at this point
Still don't understand what you are trying to achieve.
What do you mean by length of line? Do you mean length of String that contains the line?
What do you mean by "continue tabbed over on the next line"? are you talking about continuing on the next line on console? some GUI component?
servlet is offline   Reply With Quote
Old 04-13-2010, 07:58 AM   PM User | #3
RocketmanJP
New to the CF scene

 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
RocketmanJP is an unknown quantity at this point
oh nevermind i figured it out, here is what i was trying to do

Code:
        int length = title.length();
	int cutoff = 37;

	if (length > cutoff){
	    String t1 = title.substring(0, cutoff);
	    int x = t1.lastIndexOf(" ");
	    title = title.substring(0, x) + "\n\n" + title.substring(x);
	}
RocketmanJP is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:08 PM.


Advertisement
Log in to turn off these ads.