string tokenizer


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: string tokenizer

  1. #1
    Join Date
    Oct 2003
    Posts
    12

    string tokenizer

    Dear friends

    can any body tell me why this code is not working. when i compile it, it gives me some errors about the array of tokenizer
    Code:
       
      //.......................Tokenizer function.............
      strindex = 2;
       int[] size = new int[1000]; 
       StringTokenizer stok = new StringTokenizer(string[1000]);
       
       for(int i= 0; i< strindex;i++)
       {  
               stok[i] = StringTokenizer(string[i]);
              size[i] = stok[i].countTokens();
       }
    [ArchAngel added CODE tags]

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    Firstly, it helps when you post if you post the compiler errors - it saves us having to look so hard.

    In this case it's the line:
    Code:
    stok[i] = StringTokenizer(string[i]);
    This line makes little sense for a couple of reasons:

    1. 'stok' is declared as a reference variable to a StringTokenizer, not an array of StringTokenizers, so you can't reference an element on it.

    2. You can't just call 'StringTokenizer(String[i])'. I'm guessing you meant to type 'new StringTokenizer(string[i]).
    ArchAngel.
    O:-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center