I have a function node that send msg.payload to a terminal program for communication with a 4G modem.
How can I put " " so that the outgoing 'meg.payload +text' looks like "value my text "
and not just like, value-my-text
The code below almost works, but I have to use - to concatenate the sentence into a 'word', but it doesn't work with negative values
Have tested most combinations of this, without getting it to work with spaces or - characters from the temperature gauge.
Ended up with this solution which works satisfactorily, without having understood why this works.
Also works with negative values
I don't see how that relates to your original question about including double quotes in a string... but I'm glad you figured out a solution to the problem.
I'm a total noob so I don't understand the whole sequence, but I get "" these in the exec node now, and the message is sent to the phone, like this
/4G/send-sms.js 12345678 "text message"
"text message" is add msg.payload in exec-node
I really appreciate any corrections, so maybe there is hope for an old man to learn some programming
@knolleary Thanks for setting me on the right track
I finally figured out the problem, firstly there was a mistake in your suggestions with one " character too much, which I should have seen myself. The second was that what I typed in the node-red editor was not correct even windows is set to English keyboard, so had to write the code line in notepad and paste the whole line into the node-red editor. (haven't found out why)
Starting msg.payload with a text string instead of a number also solved the problem with negative values. So end up with this option.