RM action returns empty string variable Str2:
Set Str2 with token(1) delimited by '.' from variable: Str1(2.22)
Why?
RM action returns empty string variable Str2:
Set Str2 with token(1) delimited by '.' from variable: Str1(2.22)
Why?
The "tokenize" operation uses a regular expression (regex) as the token. Internally, this is implemented with the Java/Groovy split()
method. This is why "escaping" the period (which is a special character in a regex) provides the output you're looking for.
It sounds like it is taking the delimiter as a raw input to a regular expression. That's kind of interesting. I wonder if it would work with something like [;:]? So it would break on either a colon or semicolon.
It doesn't really apply to anything. I didn't know RM could do something like that and find it mildly interesting.
I have been using delimited for so many functions. I wanted a way to grab a decimal number ending 2.10 that displays in format is 2.1 without the "0". By converting the decimal to a string, and adding "0" to the end of the string for a number that is delimited in Str2 < 10, I can get the format that I want for a string conversion number like "2.10". For now, I have been sending decimal numbers to a Hubitat competitor and having it send back a formatted string ie: Send decimal 2.1 and get back String "2.10". Tree.log, thanks for the "For now". bertabcd1234, thank you. You answered my question "why?"
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.