I have the following hexadecimal byte array:
Byte[] Bytes = { 0x02, 0x31, 0x20, 0x20, 0x20, 0x20, 0x32,
0x36, 0x38, 0x30, 0x34, 0x03, 0x0D };
And I converted the it to a string using BitConverter
:
String value = BitConverter.ToString(Bytes);
At this point, value
looks like:
"02-31-20-20-20-20-32-36-38-30-34-03-0D"
Now I need to eliminate the values from 02
to the last 20
and from 03
to 0D
. In other words, I need to extract 32-36-38-30-34
by eliminating the rest.
The key point is that 0x02
in hexadecimal represents "Start of Text", 0x20
represents a space, and 0x03
represents "End of Text". So I need to eliminate all the values from "Start of Text" to the last space, and from "End of Text" to obtain values between them.