• Post Reply Bookmark Topic Watch Topic
  • New Topic

StringTokenizer  RSS feed

 
jite eghagha
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one understand why my token returns an entire line? it totally ignores the "\t" delimeter i set.

My file i'm reading for is tad demlimeted in Excel.

String line = buff.readLine();
for(int y = 0; y < getMaxV(); y++)
StringTokenizer tok = new StringTokenizer(line, "\t");
string = tok.nextToken();
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jite eghagha:
Any one understand why my token returns an entire line? it totally ignores the "\t" delimeter i set.

My file i'm reading for is tad demlimeted in Excel.

String line = buff.readLine();
for(int y = 0; y < getMaxV(); y++)
StringTokenizer tok = new StringTokenizer(line, "\t");
string = tok.nextToken();


Does this mean that you are declaring and initializing the tok variable getMaxV times, and then getting string = tok.nexToken() once?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!