DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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:-)

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links