[rules-users] string tokenizer import issue in drl

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jun 12 00:57:01 EDT 2012


On 11/06/2012, vysrinivas <vysrinivas at gmail.com> wrote:
> Hi Laune,
>
> Thanks for your reply.
>
> Please find the java code which has to be incorporated in drl file.
>

I don't see anything in this snippet close to a rule in that code down
below, and StringTokenizer doesn't appear at all.

> could you please give the respective drool code for the same. Version of
> drools is 2.0.

Are you sure? Drools 5 has been around for a long time now, and we're
now at 5.4.0... Sorry, but I'm not prepared to advise on Drools 2.0.

-W

>
> class pricing {
> 	public static void main(String args[]) {
>
> 		String subsrtComment = null;
> 		String note = " QTYPE=PRICE|QSTATUS=YES ";
> 		String QType = null;
> 		note = note.trim();
> 		if (note.contains("QTYPE")) {
> 			int ind1 = note.indexOf("QTYPE");
> 			String subsrt = note.substring(ind1);
>
> 			if (subsrt.contains("|")) {
> 				int ind2 = subsrt.indexOf("|");
> 				QType = subsrt.substring(0, ind2).trim();
> 			} else {
> 				QType = note.substring(ind1).trim();
> 			}
> 			subsrtComment = QType.substring(QType.indexOf("=") + 1).trim();
> 			if (subsrtComment.length() > 0) {
> 				subsrtComment=subsrtComment.substring(0, 5);
> 				System.out.println("substr1="+subsrtComment);
> 			} else {
> 				subsrtComment = null;
> 				System.out.println("substr2="+subsrtComment);
> 			}
> 		} else {
> 			subsrtComment = null;
> 			System.out.println("substr3="+subsrtComment);
> 		}
>
> 	}
> }
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/string-tokenizer-import-issue-in-drl-tp4017845p4017847.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list