Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Formatting Help

  1. #1
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    Regular Coder
    Join Date
    Jan 2009
    Location
    india
    Posts
    145
    Thanks
    0
    Thanked 5 Times in 5 Posts
    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?

  • #3
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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);
    	}


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •