first of all, i am no coder, but fiddling longtime with node-red.
now i want a part of a string in a function-node,
but get crazy results. to my impression substring() and substr() and slice() should cut out a part of the string, but all results are different.
anybody with a hint for me?
can i post the flow in a horizontal way? seen that here around, but the hint doesnt help me to post is horizontal and smaller (How to share code or flow json)
better flow-show (edit):
[{"id":"c8801ef73e9aea5e","type":"inject","z":"e53ac3e112912e4f","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"#!1234567890abcdefgh","payloadType":"str","x":1300,"y":1120,"wires":[["1d7eef6c963d591b"]]},{"id":"1d7eef6c963d591b","type":"function","z":"e53ac3e112912e4f","name":"cast substring to hex","func":"var data = msg.payload\n\n//var sub1 = data.substring(8, 2);\n//msg.substring1 = sub1;\n\nvar substr = data.substr(8, 2);\nmsg.substring2 = substr;\n\nvar slice = data.slice(8, 2);\nmsg.slice = slice;\n\n\nvar sub1 = data.substring(8, 2);\nmsg.substring1 = sub1;\n\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1580,"y":1120,"wires":[["8f97295851177c9e"]]},{"id":"8f97295851177c9e","type":"debug","z":"e53ac3e112912e4f","name":"subrintg","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1800,"y":1120,"wires":[]}]