Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions About Parsing criteriaFind Str

 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All:
I have written a parser for the crieriaFind method, but there sure isn't anything elegant about it. It's kind of all brute force if you know what I mean. Is this just the nature of the beast. Do others have heinous String parsers in criteriaFind? Is there a way to reuse StringTokenizer? I had to have three instances of the StringTokenizer class because it looks like it's the constructor that does all the work? One final question...can you do this. I mean, I can igure out if you can do it, but is it a bad practice?-->
StringTokenizer s = new StringTokenizer("somestring");
//process string, then...
s = new StringTokenizer("anotherstring);
instead of creating a whole new ref...Thanks.
 
Jeb Beasley
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can reuse the same tokenizer, just pass in new dilimeters when you call nextToken( newDelimiter ).
If you want elegant, I favor
StreamTokenizer( new StringReader(theCriteria) )
You can manage eqaul signs, quoted values, and catch the spaces in field names!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic