Convert comma-delimited Arduino String of hex values to array of bytes
You only convert the String object to a char array. It need to further split the char array into substring, and then convert it to number.
To split the char array, you can use strtok() function in c++ to do the job.
There is no str conversion function that can convert &quot;0xff&quot; into uint8_t directly. However, as @rubemnobre mentioned strtol() can be used to convert a c string to a long (in Arduino, it is 4-byte number) and further cast into a uint8_t and store in a byte array.
String s = &quot;0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff&quot;;

// Convert String object to char array
unsigned int str_len = s.length()+1;
char charArray[str_len];
s.toCharArray(charArray, str_len);

uint8_t byteArray[7];
int i=0;

// split charArray at each ',' and convert to uint8_t
char *p = strtok(charArray, &quot;,&quot;);
while(p != NULL) {
  byteArray[i++] = strtoul(p, NULL, 16);
  p = strtok(NULL, &quot;,&quot;);
}

// Print the byteArray
for (i=0; i&lt;sizeof(byteArray)/sizeof(char); i++) {
  Serial.print(byteArray[i]);
  Serial.println(&quot;, &quot;);
}
Serial.println();