aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan-Perez <ivanperez2@gmail.com>2016-05-12 13:27:56 +0200
committerCristian Maglie <c.maglie@arduino.cc>2016-06-28 20:58:38 +0200
commit2d13ebbb3ea26db66794df9125208f60a93722e7 (patch)
tree92614137c04c742934e6433923ee697a6a27d2fe
parent69421dc2c740334578f74a9441bc1f01080b3a95 (diff)
WString.h: allow modifying the string while iterating
-rw-r--r--cores/arduino/WString.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h
index 89fcaa5..de5632c 100644
--- a/cores/arduino/WString.h
+++ b/cores/arduino/WString.h
@@ -159,8 +159,10 @@ public:
char& operator [] (unsigned int index);
void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const;
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
- {getBytes((unsigned char *)buf, bufsize, index);}
+ { getBytes((unsigned char *)buf, bufsize, index); }
const char* c_str() const { return buffer; }
+ char* begin() { return buffer; }
+ char* end() { return buffer + length(); }
const char* begin() const { return c_str(); }
const char* end() const { return c_str() + length(); }