FastLED 3.9.15
Loading...
Searching...
No Matches

◆ rfind() [3/4]

fl::size fl::basic_string::rfind ( const char * s,
fl::size pos,
fl::size count ) const

Definition at line 564 of file basic_string.cpp.hpp.

564 {
565 if (!s || count == 0) {
566 if (count == 0) return (pos > mLength) ? mLength : pos;
567 return npos;
568 }
569 if (count > mLength) return npos;
570 fl::size maxStart = mLength - count;
571 fl::size searchStart = (pos >= mLength || pos == npos) ? maxStart : pos;
572 if (searchStart + count > mLength) searchStart = maxStart;
573 const char* str = c_str();
574 for (fl::size i = searchStart + 1; i > 0; --i) {
575 fl::size idx = i - 1;
576 if (idx + count > mLength) continue;
577 bool match = true;
578 for (fl::size j = 0; j < count; ++j) {
579 if (str[idx + j] != s[j]) { match = false; break; }
580 }
581 if (match) return idx;
582 }
583 return npos;
584}
uint8_t pos
Definition Blur.ino:11
static constexpr fl::size npos
const char * c_str() const FL_NOEXCEPT

References c_str(), mLength, npos, and pos.

+ Here is the call graph for this function: