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

Unified Diff: base/string_util.cc

Issue 8885: Implementation of the UI part of the autofill (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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/string_util.h ('k') | base/string_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_util.cc
===================================================================
--- base/string_util.cc (revision 4621)
+++ base/string_util.cc (working copy)
@@ -659,6 +659,19 @@
return base::strncasecmp(str.c_str(), search.c_str(), search.length()) == 0;
}
+bool StartsWith(const std::wstring& str,
+ const std::wstring& search,
+ bool case_sensitive) {
+ if (case_sensitive)
+ return str.compare(0, search.length(), search) == 0;
+ else {
+ if (search.size() > str.size())
+ return false;
+ return std::equal(search.begin(), search.end(), str.begin(),
+ CaseInsensitiveCompare<wchar_t>());
+ }
+}
+
DataUnits GetByteDisplayUnits(int64 bytes) {
// The byte thresholds at which we display amounts. A byte count is displayed
// in unit U when kUnitThresholds[U] <= bytes < kUnitThresholds[U+1].
« no previous file with comments | « base/string_util.h ('k') | base/string_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698