Go Down

Topic: String.replace() return value incorrect in documentation (Read 50 times) previous topic - next topic

esel7353

The documentation page of String.replace() http://arduino.cc/en/Reference/StringReplace states that the return value of replace() is a new String with replaced characters, but the replace method actually returns void and changes the String in place as shown in the example http://arduino.cc/en/Tutorial/StringReplace.


pYro_65

You are correct. https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/avr/cores/arduino/WString.h#L179

In the goal of keeping the library as flexible as possible it should also return a reference to itself allowing method chaining or use as a function parameter.


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy