MCPcopy Create free account
hub / github.com/apache/arrow / gdv_boolean compare_lower_strings

Function gdv_boolean compare_lower_strings

cpp/src/gandiva/precompiled/string_ops.cc:522–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520}
521
522FORCE_INLINE
523gdv_boolean compare_lower_strings(const char* base_str, gdv_int32 base_str_len,
524 const char* str, gdv_int32 str_len) {
525 if (base_str_len != str_len) {
526 return false;
527 }
528 for (int i = 0; i < str_len; i++) {
529 // convert char to lower
530 char cur = str[i];
531 // 'A' - 'Z' : 0x41 - 0x5a
532 // 'a' - 'z' : 0x61 - 0x7a
533 if (cur >= 0x41 && cur <= 0x5a) {
534 cur = static_cast<char>(cur + 0x20);
535 }
536 // if the character does not match, break the flow
537 if (cur != base_str[i]) break;
538 // if the character matches and it is the last iteration, return true
539 if (i == str_len - 1) return true;
540 }
541 return false;
542}
543
544// Try to cast the received string ('0', '1', 'true', 'false'), ignoring leading
545// and trailing spaces, also ignoring lower and upper case.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected