How to a comma into a payload string 123456 into 123,456

Hello,

I'm trying to turn a string .payload from 123456 into 123,456.

The reason for adding the comma is to split-up and then use a split node to only change the second part ,456 using parts/index:# into a step then join the message back together, so the message would look like 123,1.

I have look for the solution but it likely so simple no-one has asked :frowning:
If someone could enlighten me would be :love_letter:

msg.payload = parseInt(msg.payload).toLocaleString();
in a function node

Or parseFloat()

2 Likes

This worked perfectly, thanks a bunch! Hours banging my head trying to work it out.

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