Please help me code an if statement in 'C' for Arduino

WBahn

Joined Mar 31, 2012
30,086
If you were to execute the line "Serial.print(myString.substring(5))" and myString was "abcdefghij" would you expect a pointer value or "ghij"?
I would expect, based on other object-oriented languages, for the compiler to implicitly invoke a ToString method of some kind on the string object returned by the myString.substring(5) call.

I'm saying that myString.substring(5), for instance, returns a reference to a string object that consists of one character if myString has six characters and it returns a reference to a string object that consists of multiple characters if it has more than six. Look at the examples in the Arduino reference.
That's what I would expect, too. So I would not expect making an equality comparison between an ASCII value to either to yield a True result. Unless, and this is certainly possible, the equality operator is overloaded such that when comparing an integer to a String object the integer value is boxed and converted to a String.

Overall, it seems like the Arduino language is putting a lot of overhead onto a poor microcontroller.
 
Top