29 namespace ace_common {
31 int strcmp_PP(
const char* a,
const char* b) {
32 if (a == b) {
return 0; }
33 if (a ==
nullptr) {
return -1; }
34 if (b ==
nullptr) {
return 1; }
37 uint8_t ca = pgm_read_byte(a);
38 uint8_t cb = pgm_read_byte(b);
39 if (ca != cb)
return (
int) ca - (int) cb;
40 if (ca ==
'\0')
return 0;
46 #if defined(ESP8266) || defined(ESP32)
48 const char* strchr_P(
const char* s,
int c) {
51 char d = pgm_read_byte(s);
52 if (cc == d)
return s;
53 if (!d)
return nullptr;
58 const char* strrchr_P(
const char* s,
int c) {
60 const char* found =
nullptr;
62 char d = pgm_read_byte(s);
63 if (cc == d) found = s;
String functions on strings stored in flash memory through the PROGMEM attribute.