MCPcopy Create free account
hub / github.com/asmuth/clip / compare

Method compare

src/utils/stringutil.cc:225–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225int StringUtil::compare(
226 const char* s1,
227 size_t s1_len,
228 const char* s2,
229 size_t s2_len) {
230 for (; s1_len > 0 && s2_len > 0; s1++, s2++, --s1_len, --s2_len) {
231 if (*s1 != *s2) {
232 return (*(uint8_t *) s1 < *(uint8_t *) s2) ? -1 : 1;
233 }
234 }
235
236 if (s1_len > 0) {
237 return 1;
238 }
239
240 if (s2_len > 0) {
241 return -1;
242 }
243
244 return 0;
245}
246
247
248bool StringUtil::isHexString(const std::string& str) {

Callers 2

beginsWithMethod · 0.80
endsWithMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected