String to number problem

I am scarping data from a web and I need to change from string to number. If I try to use this:
msg.payload = Number(msg.payload);
return msg
It doesn´t work for me as in Spain we use "," as "."
The fisrt debug is the data I want to change to number and the second one is what I get.
If the value is 0 it works fine.
Any idea how can I do it?

(PD: Sorry for my english :slight_smile: )

a quick google search finds this How to change commas into dots with JavaScript

1 Like

hi @Rufus,
Are you using function node?
try trim() values befor number().

if you are using change node, try it

if you know the maximum length of each array element that you realy want, you could test element length and exclude element [0] and [1] (for exemple) from your array. it will result in a new array that you can really convert to number.

Thanks for the quick response guys
I tried @zenofmud solution and it worked, thank you.

Next time I´ll try simple google seaches :slight_smile:

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