Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1046)

Unified Diff: base/strings/string_util.h

Issue 1182183003: Move EndsWith to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/strings/string_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string_util.h
diff --git a/base/strings/string_util.h b/base/strings/string_util.h
index 12915f7a13ebe61477ff666bb82304e3600d4952..5f7e437a16f60a30c0502503ed15481190ec9bfd 100644
--- a/base/strings/string_util.h
+++ b/base/strings/string_util.h
@@ -316,6 +316,9 @@ BASE_EXPORT bool LowerCaseEqualsASCII(const char16* a_begin,
BASE_EXPORT bool EqualsASCII(const string16& a, const StringPiece& b);
// Returns true if str starts with search, or false otherwise.
+// TODO(brettw) the case sensitive flag makes callsites difficult to read.
+// Consider splitting this out in two variants (few callers want
+// case-insensitive compares) or use an enum that makes this more explicit.
BASE_EXPORT bool StartsWithASCII(const std::string& str,
const std::string& search,
bool case_sensitive);
@@ -323,6 +326,15 @@ BASE_EXPORT bool StartsWith(const base::string16& str,
const base::string16& search,
bool case_sensitive);
+// Returns true if str ends with search, or false otherwise.
+// TODO(brettw) case sensitive flag confusion, see StartsWith above.
+BASE_EXPORT bool EndsWith(const std::string& str,
+ const std::string& search,
+ bool case_sensitive);
+BASE_EXPORT bool EndsWith(const base::string16& str,
+ const base::string16& search,
+ bool case_sensitive);
+
} // namespace base
#if defined(OS_WIN)
@@ -333,15 +345,6 @@ BASE_EXPORT bool StartsWith(const base::string16& str,
#error Define string operations appropriately for your platform
#endif
-// Returns true if str ends with search, or false otherwise.
-BASE_EXPORT bool EndsWith(const std::string& str,
- const std::string& search,
- bool case_sensitive);
-BASE_EXPORT bool EndsWith(const base::string16& str,
- const base::string16& search,
- bool case_sensitive);
-
-
// Determines the type of ASCII character, independent of locale (the C
// library versions will change based on locale).
template <typename Char>
« no previous file with comments | « no previous file | base/strings/string_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698