arduino / arduino/ArduinoCore-megaavr

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

Open
#109 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
111
Forks
65
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the provided sketch on an Arduino Uno WiFi Rev. 2 and compare the serial output with the expected 16,17 result. Start at the String.replace entry point and verify behavior for the encoded strings; done means both replacements produce the expected final output without a workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.