Arduino 1.0 string changes require changes to examples

Suddenly, with 1.0, a "sketch" no longer would "verify".

I looked at the documentation and found a note that says "As of 1.0, toUpperCase() modifies the string in place rather than returning a new one. "

I thought that an interesting change and took the link to the example at but found that it DOESN'T WORK with 1.0.

I fingered out what the cryptic line means and that it implied changing, for example stringTwo = stringTwo.toLowerCase(); to stringTwo.toLowerCase();

Great! I've got it, but I want my code to work on any version during this transition time. I got that fingered out too, and wrote:

if defined(ARDUINO) && ARDUINO >= 100 // 1.00 or later



stringTwo = stringTwo.toLowerCase(); // pre 1.0


Now I want to fix the example to show exactly this code, so it will work for everyone. It will also explain the change to everyone and give an example of universal code. When I try, it says "Insufficient privileges to perform action."

How do I become one of the "privileged" few? (one percent?)

I am confused. Even with the changes to String, shouldn't the old example work? Maybe it redundantly takes stringTwo and copies/moves it to stringTwo, but this shouldn't keep the example from working. What is really going on here?

No, it fails the verify step. While searching for the answer to the new format, I found that this was done on purpose. In this post the developer says:

Changing trim(), replace(), toUpperCase(), and toLowerCase() to not return the string after they modify it. This makes it clearer that they operate on the string they're called on, rather than returning a new string and leaving the original unchanged. It means that prior code that used these functions will get a compiler error, which I prefer to silently changing the behavior of a program.

(bold added)

This is the error it produces:

cpp: In function 'void loop()': 24: error: no match for 'operator=' in 'stringOne = stringOne.String::toUpperCase()' C:...\arduino/WString.h:83: note: candidates are: String& String::operator=(const String&) C:...\arduino/WString.h:84: note: String& String::operator=(const char*)

Oh gods of Arduino on high hear my plea! Please change the toLowerCase and the toUpperCase examples to reflect the change in syntax. Ver 1.0 syntax is: stringOne.toLowerCase(); stringOne.toUpperCase(); not stringOne = stringOne.toUpperCase(); Wasted my morning chasing this down. Thank you.

The example for trim also needs changed: Syntax in example Is: stringOne = stringOne.trim(); Should be: stringOne.trim();

I'm the guy who rewrote String, to fix the many bugs it had in 0019 to 0023. I make the Teensy boards. When I put String into Teensyduino, people were having all sorts of problems. It was incredibly buggy. I put a LOT of work into fixing the many problems, and carefully analyzing and optimizing memory allocation patterns.

The String I contributed had trim(), toUpperCase() and toLowerCase() return a reference to the original string, so these very common usage cases would be backwards compatible. In fact, the version of String currently in Teensyduino still has these, so the examples work properly on Teensy boards. :)

Sadly, many changes were made to my code. Much of the careful work I did, especially on optimizing memory allocation, just doesn't apply on Arduino's version. Many usages of String that should work simply do not on Arduino's version. Some even crash. There's nothing I can do now about Arduino. I tried very hard to make String work as well as possible (and it does on Teensy), and I tried to share that with all Arduino users. I really wish it had turned out better.

Don't feel bad Paul. For years I was a VB programmer... then after VB6 good old MF... excuse me I meant MS ...Freudian slip. Good old MS decided that VB was not sophisticated enough so they ripped the shit out of it and made it into a lame Java or C# clone. I tried to re-compile a major app I was working on and got 670 error messages! Needles to say I did not and have not migrated.

Anyway you tried... Thanks