SIGN IN SIGN UP

String relational operators

The String class has an incomplete set of relational operators with
`const char*`. The 6 operators `==`,`!=`,`<`,`>`,`<=`,`>=` must be
defined between String and String, but also between String and `const
char*`.

The motivation is to treat left and right operands symmetrically.  str
== "hello" works, but swapping arguments to "hello" == str doesn't,
which is a potential user surprise.

As String is implicitly convertible from `const char*`, but this incurs
a "strdup". So it also makes sense to provide relational operators
directly with const char* to avoid the expensive promotion of const
char* to temporary String, just to do a string value comparison.

Resolves: #7139
B
Billy Donahue committed
893bcc54b928459af1107d31f2a08d25a9fba1d4
Parent: b99609e
Committed by Martino Facchin <m.facchin@arduino.cc> on 10/29/2018, 1:29:40 PM