*.replace(); funktioniert auf dem Arduino Uno Wifi Rev. 2 nicht

Danke für den Code.
Das Problem ist allerdings, dass ich ja als Ausgang einen String habe in meinem Programmablauf und nicht einfach einen char currentLine[] = "%2216%22,%20%2217%22"; definieren kann. Deshalb verwende ich currentLine.toCharArray, um einen char zu bekommen. Dann funktioniert aber removestr wieder nicht...

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);
  
  String currentLine = "%2216%22,%20%2217%22"; 
  int str_len = currentLine.length() +1;
  Serial.println(str_len);
  char char_array[str_len];
  currentLine.toCharArray(char_array, str_len);
  
  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() {}

Beim Kompilieren tritt der Fehler

sketch_sep11a:31:31: error: cannot convert 'arduino::String' to 'char*' for argument '1' to 'char* removestr(char*, const char*)'
   removestr(currentLine, "%22");
                               ^
sketch_sep11a:33:31: error: cannot convert 'arduino::String' to 'char*' for argument '1' to 'char* removestr(char*, const char*)'
   removestr(currentLine, "%20");

``` auf