Rysig
1
Hello,
I'm new and I'd like to get some help to split a string into separate elements in NodeRed.
As an example,
- my msg.payload is '11110110'
- and I like to get separate data/lines (array) such as 1, 1, 1, 1, 0, 1, 1 and 0
Can I do this with "split" and how?
Thanks again!
David
You can use the split node to get 8 seperate messages
You can then use the join node to get those into an array
2 Likes
Above solution is perfect. Alternatively you could use below piece of code inside a function node.
msg.payload = [...msg.payload];
return msg;
This way an incoming string will be changed to an array.
1 Like
system
Closed
5
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.