• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to tokenize the particular string with AND and OR conditions inside it  RSS feed

 
subba rao
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from JSP below Category string will passed;How to compare the Category with the Category that is stored in Hashtable key and replace with the values?

For example if Category comes as "Entire Category AND Full-Res PDF PDF (print)" then final output should as "900014 AND 724242"

if another Category comes as "(Composite Pattern AND Cover) OR (Full-Res PDF (print) AND Cover)" then final output should as "(36363636 AND 7697979) OR (724242 AND 7697979) "

1.Entire Category AND Full-Res PDF PDF (print)
2.Cover Image OR (Full-Res PDF (print) AND Entire Category)
3.Composite Pattern OR Full-Res PDF (print)
4.(Composite Pattern AND Cover) OR (Full-Res PDF (print) AND Cover)
Category and the value will be stored in the Hashtable.

hashtable.put("Entire Category","900014");
hashtable.put("Full-Res PDF PDF (print)","724242");
hashtable.put("Composite Pattern","36363636");
hashtable.put("Entire Category","352525");
hashtable.put("Cover Image","95757");
hashtable.put("Cover","7697979");
 
Knute Snortum
Sheriff
Posts: 4081
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried using String.replace()? Post the code of what you've tried.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!