String example = "lec dwm> DIST,1,AN0,373D,1.63,5.09,15.49,0.20 DIST,1,AN0,373D,1.63,5.09,15.49,0.21 DIST,1,AN0,373D,1.63,5.09,15.49,0.00";
char *split(char *str, const char *delim)
{
char *p = strstr(str, delim);
if (p == NULL) return NULL; // delimiter not found
*p = '\0'; // terminate string after head
return p + strlen(delim); // return tail substring
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
char *tail;
tail = split(example, "DIST");
if (tail) {
Serial.println("head:");
Serial.println(example);
Serial.println("tail: ");
Serial.println(tail);
}
}
void loop() {
// put your main code here, to run repeatedly:
}