- openHABian 3.3.4 on rPi4 with 4GB
I get an error on a rule where I am looking for an index that does not exist; e.g.
In other languages I can say:
uin8_t num_elements = blah.split("|") and num_elements contains the number of elements in the array.
var split_result = Integer::parseInt(ws_Notification.state.toString.split("|"))
… does not work.
2023-05-01 00:13:24.690 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'weather-1' failed: Index 2 out of bounds for length 1 in weather
Is there a similar way in OH to achieve the desired outcome?
Why? Because I want to test if there are three elements before trying to assing it to a variable.