# Sorting a string

**URL:** <https://discourse.nodered.org/t/sorting-a-string/72739>\
**Category:** General\
**Created:** [26 December 2022 16:46 UTC](https://discourse.nodered.org/t/sorting-a-string/72739 "2022-12-26T16:46:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ignalonso](https://avatars.discourse-cdn.com/v4/letter/i/5e9695/32.png) [@ignalonso](https://discourse.nodered.org/u/ignalonso)\
**Post date:** [26 December 2022 16:46 UTC](https://discourse.nodered.org/t/sorting-a-string/72739/1 "2022-12-26T16:46:52Z")

</div>

I´m getting this value:

0.20607  
€/kWh

but i just want the numerical part.  
0.20607 How can i get it ?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [26 December 2022 16:52 UTC](https://discourse.nodered.org/t/sorting-a-string/72739/2 "2022-12-26T16:52:01Z")

</div>

Can you add a debug node (set to display the complete msg object) to where ever you see that and show us what the complete object looks like.

It looks like it is a string on two lines, so you could do it with a `function` node and the javascript string split(). A quick google search will show you how to use it.

And please don't ask the same question in multiple threads. I'll close the other thread now.

---

<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:** [24 February 2023 16:52 UTC](https://discourse.nodered.org/t/sorting-a-string/72739/3 "2023-02-24T16:52:57Z")

</div>

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