# Problems with SPLIT node and strings

**URL:** <https://discourse.nodered.org/t/problems-with-split-node-and-strings/40373>\
**Category:** General\
**Created:** [4 February 2021 11:19 UTC](https://discourse.nodered.org/t/problems-with-split-node-and-strings/40373 "2021-02-04T11:19:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![projecttwo](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@projecttwo](https://discourse.nodered.org/u/projecttwo)\
**Post date:** [4 February 2021 11:19 UTC](https://discourse.nodered.org/t/problems-with-split-node-and-strings/40373/1 "2021-02-04T11:19:33Z")

</div>

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:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/887d485bd6dc261ec72c80456892db8587d30eaa.png)

the answer:  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/9796d6cfb14c687ee27e04b975bbed9ae4a44276.png)

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...)

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [4 February 2021 11:35 UTC](https://discourse.nodered.org/t/problems-with-split-node-and-strings/40373/2 "2021-02-04T11:35:10Z")

</div>

Example :

```auto
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];`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 April 2021 11:35 UTC](https://discourse.nodered.org/t/problems-with-split-node-and-strings/40373/3 "2021-04-05T11:35:13Z")

</div>

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