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

Unified Diff: base/strings/string_util.cc

Issue 1172753003: Move LowerCaseEqualsASCII to base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util
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 | « base/strings/string_util.h ('k') | chrome/browser/auto_launch_trial.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string_util.cc
diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc
index 6f6d6e2b6bd240997c822374adf3126108881d9e..9fd823aa964e847619c55f53800238c270e368f0 100644
--- a/base/strings/string_util.cc
+++ b/base/strings/string_util.cc
@@ -420,14 +420,12 @@ bool IsStringUTF8(const StringPiece& str) {
return true;
}
-} // namespace base
-
template<typename Iter>
static inline bool DoLowerCaseEqualsASCII(Iter a_begin,
Iter a_end,
const char* b) {
for (Iter it = a_begin; it != a_end; ++it, ++b) {
- if (!*b || base::ToLowerASCII(*it) != *b)
+ if (!*b || ToLowerASCII(*it) != *b)
return false;
}
return *b == 0;
@@ -460,12 +458,26 @@ bool LowerCaseEqualsASCII(const char* a_begin,
return DoLowerCaseEqualsASCII(a_begin, a_end, b);
}
+bool LowerCaseEqualsASCII(const char* a_begin,
+ const char* a_end,
+ const char* b_begin,
+ const char* b_end) {
+ while (a_begin != a_end && b_begin != b_end &&
+ ToLowerASCII(*a_begin) == *b_begin) {
+ a_begin++;
+ b_begin++;
+ }
+ return a_begin == a_end && b_begin == b_end;
+}
+
bool LowerCaseEqualsASCII(const char16* a_begin,
const char16* a_end,
const char* b) {
return DoLowerCaseEqualsASCII(a_begin, a_end, b);
}
+} // namespace base
+
bool EqualsASCII(const string16& a, const base::StringPiece& b) {
if (a.length() != b.length())
return false;
« no previous file with comments | « base/strings/string_util.h ('k') | chrome/browser/auto_launch_trial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698