![]()
Or to be on the relative safe side
char message[] = "p2000e99a63b73";
char *ptr = strchr(message,’e’); //http://www.cplusplus.com/reference/cstring/strchr/
long value = LONG_MIN; // http://www.cplusplus.com/reference/climits/
if (ptr) {
value = atol(ptr+1); // http://www.cplusplus.com/reference/cstdlib/atol/?kw=atol
Serial.println(value); // if no number after the ‘e’ value will be 0
} else {
Serial.println(F(“Error”)); // and value is LONG_MIN
}
For atol() If the converted value would be out of the range of representable values by a long int, it causes undefined behavior. strtol() would be a more robust cross-platform alternative when this is a possibility.