diff options
Diffstat (limited to 'absl/strings/match.cc')
-rw-r--r-- | absl/strings/match.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/absl/strings/match.cc b/absl/strings/match.cc index 25bd7f0b828b..3d10c57784eb 100644 --- a/absl/strings/match.cc +++ b/absl/strings/match.cc @@ -27,6 +27,13 @@ bool CaseEqual(absl::string_view piece1, absl::string_view piece2) { } } // namespace +bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) { + return (piece1.size() == piece2.size() && + 0 == absl::strings_internal::memcasecmp(piece1.data(), piece2.data(), + piece1.size())); + // memcasecmp uses absl::ascii_tolower(). +} + bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix) { return (text.size() >= prefix.size()) && CaseEqual(text.substr(0, prefix.size()), prefix); |