FastLED 3.9.15
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 1180 of file basic_string.cpp.hpp.

1180 {
1181 if (!s) {
1182 if (pos1 >= mLength) return (count2 == 0) ? 0 : -1;
1183 fl::size actualCount1 = count1;
1184 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1185 actualCount1 = mLength - pos1;
1186 }
1187 return (actualCount1 > 0) ? 1 : ((count2 == 0) ? 0 : -1);
1188 }
1189 if (pos1 > mLength) return (count2 == 0) ? 0 : -1;
1190 fl::size actualCount1 = count1;
1191 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1192 actualCount1 = mLength - pos1;
1193 }
1194 fl::size minLen = (actualCount1 < count2) ? actualCount1 : count2;
1195 int result = fl::strncmp(c_str() + pos1, s, minLen);
1196 if (result != 0) return result;
1197 if (actualCount1 < count2) return -1;
1198 if (actualCount1 > count2) return 1;
1199 return 0;
1200}
static constexpr fl::size npos
const char * c_str() const FL_NOEXCEPT
int strncmp(const char *s1, const char *s2, size_t n) FL_NOEXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

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

+ Here is the call graph for this function: