Skip to content

Commit

Permalink
WString explicit converters to reduce Flash size (espressif#3497)
Browse files Browse the repository at this point in the history
* WString explicit converters to reduce Flash size

This is a port from the same patch for ESP8266: https://github.com/esp8266/Arduino/pull/6759/files
  • Loading branch information
everslick authored and me-no-dev committed Jan 20, 2020
1 parent 7de1717 commit 3607525
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion cores/esp32/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,20 @@ class String {
unsigned char equalsIgnoreCase(const String &s) const;
unsigned char equalsConstantTime(const String &s) const;
unsigned char startsWith(const String &prefix) const;
unsigned char startsWith(const char *prefix) const {
return this->startsWith(String(prefix));
}
unsigned char startsWith(const __FlashStringHelper *prefix) const {
return this->startsWith(String(prefix));
}
unsigned char startsWith(const String &prefix, unsigned int offset) const;
unsigned char endsWith(const String &suffix) const;
unsigned char endsWith(const char *suffix) const {
return this->endsWith(String(suffix));
}
unsigned char endsWith(const __FlashStringHelper * suffix) const {
return this->endsWith(String(suffix));
}

// character access
char charAt(unsigned int index) const;
Expand Down Expand Up @@ -238,7 +250,22 @@ class String {

// modification
void replace(char find, char replace);
void replace(const String& find, const String& replace);
void replace(const String &find, const String &replace);
void replace(const char *find, const String &replace) {
this->replace(String(find), replace);
}
void replace(const __FlashStringHelper *find, const String &replace) {
this->replace(String(find), replace);
}
void replace(const char *find, const char *replace) {
this->replace(String(find), String(replace));
}
void replace(const __FlashStringHelper *find, const char *replace) {
this->replace(String(find), String(replace));
}
void replace(const __FlashStringHelper *find, const __FlashStringHelper *replace) {
this->replace(String(find), String(replace));
}
void remove(unsigned int index);
void remove(unsigned int index, unsigned int count);
void toLowerCase(void);
Expand Down

0 comments on commit 3607525

Please sign in to comment.