Results 1 to 3 of 3
  1. #1
    firewalll is offline Member
    Join Date
    Sep 2009
    Posts
    7
    Rep Power
    0

    Default Extract item from a string

    I am a beginner of java...

    Does anyone know how to extract items from a string??

    String region = "USA,JAPAN,RUSSIA"

    And finally store in ArrayList <String>list

    :):):):):):) Thanks so much

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    The String#split(String regex) method can split the String on whatever you'd like (here, I'd split it on the "," comma), and place the results in an array. Please look at the API for more detail: String#split API

  3. #3
    firewalll is offline Member
    Join Date
    Sep 2009
    Posts
    7
    Rep Power
    0

Similar Threads

  1. Drag n droD for a tree item
    By jackmatt2 in forum SWT / JFace
    Replies: 0
    Last Post: 08-23-2009, 12:58 PM
  2. [SOLVED] Item too big for JComboBox
    By nwboy74 in forum AWT / Swing
    Replies: 5
    Last Post: 02-23-2009, 08:21 PM
  3. Inserting a SWT tree item at an index
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-07-2008, 04:55 PM
  4. Detecting Mouse Down In SWT Tree Item
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-07-2008, 04:51 PM
  5. grabbing an item from an arraylist.
    By newtojava7 in forum New To Java
    Replies: 1
    Last Post: 03-17-2008, 08:25 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
  •