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

◆ compare() [6/6]

int fl::basic_string::compare ( fl::size pos1,
fl::size count1,
const char * s,
fl::size count2 ) const

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

1229 {
1230 if (!s) {
1231 if (pos1 >= mLength) return (count2 == 0) ? 0 : -1;
1232 fl::size actualCount1 = count1;
1233 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1234 actualCount1 = mLength - pos1;
1235 }
1236 return (actualCount1 > 0) ? 1 : ((count2 == 0) ? 0 : -1);
1237 }
1238 if (pos1 > mLength) return (count2 == 0) ? 0 : -1;
1239 fl::size actualCount1 = count1;
1240 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1241 actualCount1 = mLength - pos1;
1242 }
1243 fl::size minLen = (actualCount1 < count2) ? actualCount1 : count2;
1244 int result = fl::strncmp(c_str() + pos1, s, minLen);
1245 if (result != 0) return result;
1246 if (actualCount1 < count2) return -1;
1247 if (actualCount1 > count2) return 1;
1248 return 0;
1249}
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 c_str(), fl::FL_NO_EXCEPT, mLength, npos, and fl::strncmp().

+ Here is the call graph for this function: