02-20-2009 02:58 AM
I'm making a VI that is communicating with an external device through a protocol built up of frames. I have made a couple of subVIs that put these frames together as hexadecimal strings that are then converted into numbers and passed on to the device. The protocol uses an escape character in order to avoid sending an BOF or EOF constant at the wrong time. I've made a subVI that is supposed to do this using the Serch and Replace function. At first it seems rather elegant, but it has a fatal flaw, if one of the characters it is supposed to hide is written across the edge of a byte, it will still be replaced.
Example:
11 01 00 EC 0D EA 05 08
is replaced by
11 01 00 E7 DE 0D EA 05 08
C0, C1, 7D are the characters to be replaced, 7D is the escape character.
Now I wonder, is it possible to make the search and replace function search only every second character in a string?
Solved! Go to Solution.
02-20-2009 03:56 AM - edited 02-20-2009 03:57 AM
02-20-2009 04:05 AM
Hi Tzench,
why don't you work with the converted numbers? It should be easier (and safer) to replace certain U8 values instead of (error-prone) search&replace in a string...
You should also be careful when giving examples. In your example the "hex numbers" are separated by spaces, so search&replace shouldn't create any trouble with "byte-border-crossing"!