# Remove manuel line break from string for msg.payload and switch

**URL:** <https://discourse.nodered.org/t/remove-manuel-line-break-from-string-for-msg-payload-and-switch/60835>\
**Category:** General\
**Created:** [5 April 2022 14:57 UTC](https://discourse.nodered.org/t/remove-manuel-line-break-from-string-for-msg-payload-and-switch/60835 "2022-04-05T14:57:54Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [5 April 2022 15:00 UTC](https://discourse.nodered.org/t/remove-manuel-line-break-from-string-for-msg-payload-and-switch/60835/2 "2022-04-05T15:00:49Z")

</div>

You can use a function node to trim the payload before the switch

```auto
msg.payload = msg.payload.trim();
return msg;

```

or use JSONata in the switch property

```auto
$trim($$.payload)

```

 ![Screenshot_20220405-160340](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/91fda4d984215a6174d9936fcb5256bb9f6ce1c8.png)

---

_[View the full topic](https://discourse.nodered.org/t/remove-manuel-line-break-from-string-for-msg-payload-and-switch/60835)._
