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

Side by Side Diff: base/strings/string_util.cc

Issue 1098843004: Omnibox - Do Not Allow HTTP/HTTPS Equivalence if User Explicitly Entered A Scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forgot string implementation 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 unified diff | Download patch
« no previous file with comments | « base/strings/string_util.h ('k') | chrome/browser/autocomplete/history_quick_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/strings/string_util.h" 5 #include "base/strings/string_util.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <math.h> 9 #include <math.h>
10 #include <stdarg.h> 10 #include <stdarg.h>
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 if (case_sensitive) { 486 if (case_sensitive) {
487 return str.compare(0, search.length(), search) == 0; 487 return str.compare(0, search.length(), search) == 0;
488 } else { 488 } else {
489 if (search.size() > str.size()) 489 if (search.size() > str.size())
490 return false; 490 return false;
491 return std::equal(search.begin(), search.end(), str.begin(), 491 return std::equal(search.begin(), search.end(), str.begin(),
492 base::CaseInsensitiveCompare<typename STR::value_type>()); 492 base::CaseInsensitiveCompare<typename STR::value_type>());
493 } 493 }
494 } 494 }
495 495
496 bool StartsWith(const std::string& str, const std::string& search,
497 bool case_sensitive) {
498 return StartsWithT(str, search, case_sensitive);
499 }
500
496 bool StartsWith(const string16& str, const string16& search, 501 bool StartsWith(const string16& str, const string16& search,
497 bool case_sensitive) { 502 bool case_sensitive) {
498 return StartsWithT(str, search, case_sensitive); 503 return StartsWithT(str, search, case_sensitive);
499 } 504 }
500 505
501 template <typename STR> 506 template <typename STR>
502 bool EndsWithT(const STR& str, const STR& search, bool case_sensitive) { 507 bool EndsWithT(const STR& str, const STR& search, bool case_sensitive) {
503 size_t str_length = str.length(); 508 size_t str_length = str.length();
504 size_t search_length = search.length(); 509 size_t search_length = search.length();
505 if (search_length > str_length) 510 if (search_length > str_length)
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 } 1030 }
1026 1031
1027 } // namespace 1032 } // namespace
1028 1033
1029 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { 1034 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) {
1030 return lcpyT<char>(dst, src, dst_size); 1035 return lcpyT<char>(dst, src, dst_size);
1031 } 1036 }
1032 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { 1037 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) {
1033 return lcpyT<wchar_t>(dst, src, dst_size); 1038 return lcpyT<wchar_t>(dst, src, dst_size);
1034 } 1039 }
OLDNEW
« no previous file with comments | « base/strings/string_util.h ('k') | chrome/browser/autocomplete/history_quick_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698