Comma delimited string to array

I need to display a QR code from an API on an OLED screen. My webhook returns a few strings, but one of them looks like the following:


I can get the contents of the qrcode with a simple substring, however I’m not sure the best way to parse my comma delimited string into an array so the result is something like:

unsigned char* image[] = [ 0B01100110,0B10100101.. ]

After looking online for a while, I was suggested a vector and stringstream.

String id = tryExtractString(parsed, "<id>", "</id>");
String qrcode = tryExtractString(parsed, "<qrcode>", "</qrcode>");
String value = tryExtractString(parsed, "<value>", "</value>");
String units = tryExtractString(parsed, "<units>", "</units>");

if (id == NULL || qrcode == NULL || value == NULL || units == NULL) {
  viewState = -1;
  txInProgress = false;

std::string _qrcode (qrcode);
std::stringstream ss(_qrcode);
std::vector<int> image;
std::string token;

while(std::getline(ss, token, ',')) {

However, std::string token cannot be pushed to vector<int> image for obvious reasons, and stoi is unavailable.

What would be the easiest way to do it?

But strtol() should be available - I only doubt that the leading 0B will be dropped automatically as a leading 0X would be.