This page last changed on Feb 01, 2014 by pjmm.

I am looking for an example of a rule to split a read string into multiple outputs.

I can control the format of the returned string it could have the following format

12,1,34,23,6,On,3,

each one of these values I would like to split and use separately

Any help would be appreciated

Not tested from top of my head, so beware of typos. It should give you an idea:

rule "split"
when
  CustomState(source=="myCommend",$val:value)
then
  java.util.StringTokenizer st = new StringTokenizer($val.toString(), ",");
  while (st.hasMoreElements()) {
    String cmd = (String) st.nextElement();
    // do something with cmd
  }
end
Posted by aktur at Feb 03, 2014 09:17
Document generated by Confluence on Jun 05, 2016 09:36