-1

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?

nader.h
  • 506
  • 2
  • 17

1 Answers1

2

Use proper Java syntax, like

str.split(",")[0].equals("23")
laune
  • 31,114
  • 3
  • 29
  • 42
  • Thanks for quick response. str.split(",")[0] == 1 works fine. What if 'str' is not String, it is of type Object? How can we cast that object to String and do that operation? eg. ((String)str).split(",")[0] == 1. This throws error in my system. – Chanduru Pushpalingam Jun 21 '16 at 05:15
  • Please ignore above comment. That one works fine. Thanks Laune. – Chanduru Pushpalingam Jun 21 '16 at 05:19