FastLED 3.10.10
Loading...
Searching...
No Matches

◆ compare() [3/6]

int fl::basic_string::compare ( fl::size pos1,
fl::size count1,
const basic_string & str ) const

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

1162 {
1163 if (pos1 > mLength) {
1164 return str.empty() ? 0 : -1;
1165 }
1166 fl::size actualCount1 = count1;
1167 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1168 actualCount1 = mLength - pos1;
1169 }
1170 fl::size minLen = (actualCount1 < str.size()) ? actualCount1 : str.size();
1171 int result = fl::strncmp(c_str() + pos1, str.c_str(), minLen);
1172 if (result != 0) return result;
1173 if (actualCount1 < str.size()) return -1;
1174 if (actualCount1 > str.size()) return 1;
1175 return 0;
1176}
static constexpr fl::size npos
const char * c_str() const FL_NO_EXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
FASTLED_FORCE_INLINE int strncmp(const char *s1, const char *s2, size_t n) FL_NO_EXCEPT
Definition cstring.h:64

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

+ Here is the call graph for this function: