Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Splitting a String by number of characters

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Splitting a String by number of characters

    If I wanted to split a string, e.g.
    String s= ("What's wrong with my code. It doesn't seem to work correctly?");

    How could I do it in a way that it is split by a specified number of characters without
    splitting a word, and the next part of the string is sent to a new line?

    Thank you in advance.


  2. #2
    Member GoodbyeWorld's Avatar
    Join Date
    Jul 2012
    Location
    Hidden command post deep within the bowels of a hidden bunker somewhere under a nondescrip building
    Posts
    161
    My Mood
    Stressed
    Thanks
    14
    Thanked 25 Times in 25 Posts

    Default Re: Splitting a String by number of characters

    The substring method of the String class might be able to help you with part of that.

  3. The Following User Says Thank You to GoodbyeWorld For This Useful Post:

    torrie (October 24th, 2013)

  4. #3
    Member
    Join Date
    Oct 2013
    Location
    india
    Posts
    31
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Splitting a String by number of characters

    StringTokenizer will help you to do any operation on string...

Similar Threads

  1. Replies: 2
    Last Post: March 28th, 2013, 09:54 AM
  2. [SOLVED] Problems with my Portholes... (String splitting and adding to lines)
    By Adzox in forum What's Wrong With My Code?
    Replies: 7
    Last Post: December 25th, 2012, 03:02 PM
  3. Help with splitting string in PDF Generator Function
    By efluvio in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 21st, 2012, 05:43 PM
  4. Splitting String
    By JuLiAnc in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 17th, 2011, 10:23 AM
  5. [SOLVED] Splitting String by Multiple Delimiters
    By relixus in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 4th, 2011, 08:54 PM

Tags for this Thread