Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WString explicit converters to reduce Flash size #6759

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions cores/esp8266/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,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,6 +250,21 @@ class String {
// modification
void replace(char find, char 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