Home arrow static arrow Java Programming [Archive] - What alternative wuld there be to using StreamTokenizer?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - What alternative wuld there be to using StreamTokenizer?
This topic has 15 replies on 2 pages.    « Previous | 1 | 2 |

Posts:2,391
Registered: 9/26/00
Re: What alternative wuld there be to using StreamTokenizer?  
Aug 5, 2004 9:13 PM (reply 15 of 15)



 
You can write inefficient code using any method/class/package; it's just a lot easier to do with regexes. For instance, if you were to use
  if (line.matches("(.*)=(.*)"))
to solve the OP's problem, the program would probably take hours to run (mostly because it would be recompiling the regex at each line, but the regex could be more efficient, too). However, the regex package does sacrifice some speed for the flexibility it affords. I'm sure an acceptably fast solution using regexes could be written for the OP's problem, but an even faster one could be written using indexOf() and substring(), and just as easily.
 
This topic has 15 replies on 2 pages.    « Previous | 1 | 2 |