Results 1 to 3 of 3
  1. #1
    everlast88az is offline Member
    Join Date
    Nov 2008
    Posts
    11
    Rep Power
    0

    Default String Tokenizer And Arraya

    I have an array for example
    String [] fruits= new String[50];
    so after I load this with stuff from the database... fruits[0] looks like this...

    oranges; apples; kiwi; strawberry; banana; mango; pear;

    I want to use stringtokenizer to parse this stuff out into tokens. So I declare an object of type stringtokenizer..


    StringTokenizer parse = new StringTokenizer(fruits, ";", 0);

    param1 = string
    param2 = token delim
    param3 says make each chunk of characters between the ; delimeter a token

    Obviously this declaration is wrong, does anyone know how to pass StringTokenizer an array? Does it accept an array? or just a simple string.

    Any help appreciated.

    thanks.

  2. #2
    everlast88az is offline Member
    Join Date
    Nov 2008
    Posts
    11
    Rep Power
    0

    Default

    nevermind
    I got it

  3. #3
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    10

    Default

    BTW, StringTokenizer is essentially deprecated. most folks just use split() from the String class

Similar Threads

  1. Store String Tokenizer o/p onto an array
    By rajchief in forum New To Java
    Replies: 1
    Last Post: 08-08-2008, 10:00 PM
  2. Parsing or Tokenizer??
    By hiklior in forum New To Java
    Replies: 15
    Last Post: 05-28-2008, 03:20 PM
  3. question on string tokenizer
    By munigantipraveen in forum New To Java
    Replies: 2
    Last Post: 05-23-2008, 06:00 AM
  4. Replies: 0
    Last Post: 11-20-2007, 05:59 PM
  5. Replies: 1
    Last Post: 08-03-2007, 11:52 AM

Posting Permissions

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