FyingEaglE
(FlyingEaglE)
September 15, 2016, 10:19pm
1
hi,
could someone give me an advice how to parse this string
S#0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
The 1st letter could change and i need it too.
each of the trailing digits represents one (physical) state (0/1)
how do i parse it to set multiple items (in one rule) to it’s corresponding state?
regards & thanks
rlkoshak
(Rich Koshak)
September 16, 2016, 5:17pm
2
val fullString = "S#0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
val splitStr = fullString.split("\#|\.") // returns an array of the parts of the String separated by # and .
val firstLetter = splitStr.get(0)
val dev0 = splitStr.get(1)
val dev1 = splitStr.get(2)
...
val dev14 = splitStr.get(15)
FyingEaglE
(FlyingEaglE)
September 16, 2016, 5:19pm
3
ah, thanks man.
it is very interesting, that split works with # and . at the same time …
FyingEaglE
(FlyingEaglE)
September 18, 2016, 1:01pm
4
in OH 1.8.3 split("#|.") doesn’t work …
Could not invoke method: org.apache.commons.lang.StringUtils.split(java.lang.String,java.lang.String) on instance: null
now i solved it with substring because split(".") or split(".") didn’t work.