diff options
Diffstat (limited to 'absl/strings/match.h')
-rw-r--r-- | absl/strings/match.h | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/absl/strings/match.h b/absl/strings/match.h index 908f051f..5805207c 100644 --- a/absl/strings/match.h +++ b/absl/strings/match.h @@ -17,7 +17,7 @@ // File: match.h // ----------------------------------------------------------------------------- // -// This file contains simple utilities for performing std::string matching checks. +// This file contains simple utilities for performing string matching checks. // All of these function parameters are specified as `absl::string_view`, // meaning that these functions can accept `std::string`, `absl::string_view` or // nul-terminated C-style strings. @@ -38,18 +38,18 @@ #include "absl/strings/string_view.h" namespace absl { -inline namespace lts_2018_06_20 { +inline namespace lts_2018_12_18 { // StrContains() // -// Returns whether a given std::string `haystack` contains the substring `needle`. +// Returns whether a given string `haystack` contains the substring `needle`. inline bool StrContains(absl::string_view haystack, absl::string_view needle) { return haystack.find(needle, 0) != haystack.npos; } // StartsWith() // -// Returns whether a given std::string `text` begins with `prefix`. +// Returns whether a given string `text` begins with `prefix`. inline bool StartsWith(absl::string_view text, absl::string_view prefix) { return prefix.empty() || (text.size() >= prefix.size() && @@ -58,7 +58,7 @@ inline bool StartsWith(absl::string_view text, absl::string_view prefix) { // EndsWith() // -// Returns whether a given std::string `text` ends with `suffix`. +// Returns whether a given string `text` ends with `suffix`. inline bool EndsWith(absl::string_view text, absl::string_view suffix) { return suffix.empty() || (text.size() >= suffix.size() && @@ -67,19 +67,25 @@ inline bool EndsWith(absl::string_view text, absl::string_view suffix) { ); } -// StartsWithIgnoreCase() +// EqualsIgnoreCase() // -// Returns whether a given std::string `text` starts with `starts_with`, ignoring +// Returns whether given ASCII strings `piece1` and `piece2` are equal, ignoring // case in the comparison. +bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2); + +// StartsWithIgnoreCase() +// +// Returns whether a given ASCII string `text` starts with `starts_with`, +// ignoring case in the comparison. bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix); // EndsWithIgnoreCase() // -// Returns whether a given std::string `text` ends with `ends_with`, ignoring case -// in the comparison. +// Returns whether a given ASCII string `text` ends with `ends_with`, ignoring +// case in the comparison. bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix); -} // inline namespace lts_2018_06_20 +} // inline namespace lts_2018_12_18 } // namespace absl #endif // ABSL_STRINGS_MATCH_H_ |