Hi all!
I need to replace the characters \n and \t from the String. I have a function but is not working properlly.
[
{
"id": "d9e4f025031e49e5",
"type": "tab",
"label": "prueba remplazo",
"disabled": false,
"info": "",
"env": []
},
{
"id": "2c626d2eb7245f69",
"type": "inject",
"z": "d9e4f025031e49e5",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Hello\\nCol\\t",
"payloadType": "str",
"x": 140,
"y": 160,
"wires": [
[
"9575e1e5f2f1aec1"
]
]
},
{
"id": "9575e1e5f2f1aec1",
"type": "function",
"z": "d9e4f025031e49e5",
"name": "",
"func": "str = msg.payload;\n\nmsg.payload = str.replace(/\\n|\\t/g, \" \");\n\nreturn msg;\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 160,
"wires": [
[
"8d794e7289334aa0"
]
]
},
{
"id": "8d794e7289334aa0",
"type": "debug",
"z": "d9e4f025031e49e5",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 160,
"wires": []
}
]
Regards!