Problems with SPLIT node and strings

Hey all,
we want to cut a string with the "SPLIT" node...

thats works very well but we got in every case two messages... one with the correct (splitted) string, but another with empty text...

the original string is "1_OWD1_2|100" and we want to have only the value behind behind the pipe.

the split node:

the answer:

how can we solve this that we only got the splitted string text?

is this possible with split-node or only with a function node and javascript-code (working, but not very easy to edit...)

Example :

msg.payload = "1_OWD1_2|100";

msg.before_pipe = msg.payload.split('|')[0];       // "1_OWD1_2"
msg.after_pipe = msg.payload.split('|')[1];        // "100"

Just for your case :

msg.payload = msg.payload.split('|')[1];

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.