J-M-L
10
char currentLine[] = "%2216%22,%20%2217%22";
char* removestr(char* str, const char* str2Remove) {
if ((str == nullptr)) return str;
size_t len = strlen(str);
if (len == 0) return str;
size_t len2Remove = strlen(str2Remove);
if (len2Remove == 0) return str;
char *readFrom = str;
char *foundAt;
while ((foundAt = strstr(readFrom, str2Remove)) != NULL) {
memmove(foundAt, foundAt + len2Remove, (readFrom + len) - (foundAt + len2Remove) + 1); // move the '\0' at the same time
readFrom = foundAt;
len -= len2Remove;
}
return str;
}
void setup()
{
Serial.begin(115200);
Serial.println(currentLine);
removestr(currentLine, "%22");
Serial.println(currentLine);
removestr(currentLine, "%20");
Serial.println(currentLine);
Serial.println("Das Ergebnis sollte 16,17 sein");
}
void loop() {}