Search code examples
droolsrule-engine

How to use String operation like split and compare in Drools condition


I have an Object with string member attribute which can have values like 23,4. Now I need to split the String in when block in drools rule like

str.split[','][0] == 23

How can I do this?


Solution

  • Use proper Java syntax, like

    str.split(",")[0].equals("23")