I have a string representing bits, such as:
\"0000101000010000\"
I want to convert it to get an array of bytes such as:
{0x
This should get you to your answer: How can I convert bits to bytes?
You could just convert your string into an array like that article has, and from there use the same logic to perform the conversion.