diff options
Diffstat (limited to 'absl/strings/match.cc')
-rw-r--r-- | absl/strings/match.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/absl/strings/match.cc b/absl/strings/match.cc index 8127cb0c..2d672509 100644 --- a/absl/strings/match.cc +++ b/absl/strings/match.cc @@ -19,19 +19,22 @@ namespace absl { ABSL_NAMESPACE_BEGIN -bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) { +bool EqualsIgnoreCase(absl::string_view piece1, + absl::string_view piece2) noexcept { 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) { +bool StartsWithIgnoreCase(absl::string_view text, + absl::string_view prefix) noexcept { return (text.size() >= prefix.size()) && EqualsIgnoreCase(text.substr(0, prefix.size()), prefix); } -bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix) { +bool EndsWithIgnoreCase(absl::string_view text, + absl::string_view suffix) noexcept { return (text.size() >= suffix.size()) && EqualsIgnoreCase(text.substr(text.size() - suffix.size()), suffix); } |