ArduinoCore-megaavr icon indicating copy to clipboard operation
ArduinoCore-megaavr copied to clipboard

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

Open oppaernst opened this issue 4 years ago • 0 comments
trafficstars

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

oppaernst avatar Sep 11 '21 13:09 oppaernst