arduino / ArduinoCore-megaavr

Arduino Core for the ATMEGA4809 CPU
103 stars 62 forks source link

*.replace(); does not work on Arduino Uno Wifi Rev. 2 #109

Open oppaernst opened 2 years ago

oppaernst commented 2 years ago

Hello,

it is not possible for me to get proper results for the following code on all of my Arduino Uno Wifi Rev. 2:

String currentLine = "%2216%22,%20%2217%22";

void setup()
{
  Serial.begin(115200);
  Serial.println(currentLine);
  currentLine.replace("%22","");
  Serial.println(currentLine); 
  currentLine.replace("%20","");
  Serial.println(currentLine);  
  Serial.println("The result should be 16,17 but it is not.");
}

void loop()
{
}

The serial monitor gives me:

%2216%22,%20%2217%22
%2216%22,%20%2217%22
%2216%22,%2217%22

The result (the last Serial.println(currentLine);) should be 16,17 but it is not.

Is there any workaround for this problem?

Kind regards