Results 1 to 2 of 2

Thread: String arrays

  1. #1
    myka is offline Member
    Join Date
    Mar 2010
    Rep Power

    Thumbs up String arrays

    hi all,

    Assume I have a String ,

    Java Code:
    String str= "01hhqwgnfklnlkgfkvvokopoepw";

    I need to divide this string in to small string blocks (2 characters in one block) and those divided blocks in to a another string array without writing a big code is there a easy way...

    my result should be:

    Java Code:
    String strArray[]= {"01","hh","qw".....etc};
    //for this part i think need a loop but please tell me how to do the spliting part?:confused:

    thanks a lot

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Rep Power


    First and easy thing that comes to mind is a loop and String.substring(). Experiment and post if you get stuck.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. Scanner, while loop and sorting arrays/string?
    By RSYR in forum New To Java
    Replies: 10
    Last Post: 04-20-2011, 07:13 PM
  2. Indexing java arrays with string
    By Jackblue in forum Advanced Java
    Replies: 10
    Last Post: 09-30-2009, 02:48 PM
  3. combine string[] into string like perl's join function
    By tekberg in forum Advanced Java
    Replies: 9
    Last Post: 02-23-2009, 02:05 PM
  4. Replies: 5
    Last Post: 01-11-2009, 11:12 AM
  5. Replies: 0
    Last Post: 11-20-2007, 05:59 PM

Posting Permissions

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