FastLED 3.10.10
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 613 of file basic_string.cpp.hpp.

613 {
614 if (!s || count == 0) {
615 if (count == 0) return (pos > mLength) ? mLength : pos;
616 return npos;
617 }
618 if (count > mLength) return npos;
619 fl::size maxStart = mLength - count;
620 fl::size searchStart = (pos >= mLength || pos == npos) ? maxStart : pos;
621 if (searchStart + count > mLength) searchStart = maxStart;
622 const char* str = c_str();
623 for (fl::size i = searchStart + 1; i > 0; --i) {
624 fl::size idx = i - 1;
625 if (idx + count > mLength) continue;
626 bool match = true;
627 for (fl::size j = 0; j < count; ++j) {
628 if (str[idx + j] != s[j]) { match = false; break; }
629 }
630 if (match) return idx;
631 }
632 return npos;
633}
uint8_t pos
Definition Blur.ino:11
static constexpr fl::size npos
const char * c_str() const FL_NO_EXCEPT

References c_str(), fl::FL_NO_EXCEPT, mLength, npos, and pos.

+ Here is the call graph for this function: