Parsing a string into a Vector of bytes most efficiently
Given a string with an even amount of characters, what's the most efficient way to parse that into a
A sample input is
Currently I'm doing the
From here I do this to parse all of the bytes;
Obviously the big one is using Regex. Any ideas?
Vector<byte> along with another Vector<byte> of bit masks?A sample input is
12 34 ?? 78 87 ?5 ?3 21 -- these are meant to be hex bytes -- which would get turned into < 0x12 0x34 0x00 0x78 0x87 0x05 0x03 0x21 > for the values, and < 0xFF 0xFF 0x00 0xFF 0xFF 0x0F 0x0F 0xFF > for the masks.Currently I'm doing the
input.Length % 2 != 0 check first, of course, followed by Regex.Matches(input, @"..").Select(match => match.Value).ToList();.From here I do this to parse all of the bytes;
Obviously the big one is using Regex. Any ideas?
