Appending Special Characters to flow

I have to sum two streams of ASCII data, 'STX'-'ASCII message'-'ETX' one of them has redundant data so I need to 'parse and pass' Should be easy, first two characters of 'ASCII message' are always 'M0' length is fixed, so i can manage to pull out wanted data all I then need is to prepend STX and append ETX Have spent about two hours trying below is my flow. Help appreciated.

Think there are various ways to do that, this is one of them.
Put it in a function node.

msg.payload = String.fromCharCode(0x02) + msg.payload + String.fromCharCode(0x03) + "\n\r"
return msg;

Thanks good solution - works just fine

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