Notice the different techniques to use tokenizer. StringTokenizer is self - explanatory,
RETokenizer tokenizes on regexs. The one in the example, treats and, AND, or and OR as
delims and also returns the delims as tokens. StringTokenizer doesnot return delims.
----------------------------------------------------------------------------------
String text;
StringTokenizer st = new StringTokenizer(text,",");
-----------
Iterator t = new RETokenizer(s,"\\s(and|AND|or|OR)\\s", returnDelims);
while(t.hasNext())
{
String cs = (String)t.next();
if(!(cs.equalsIgnoreCase(" and ") || cs.equalsIgnoreCase(" or ")))
conditionList.add(cs);
}
----------------------------------------------------------------------------------
ProtocolQuery : edu.upmc.database.SQLStatement
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment