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

Unified Diff: base/string_util.h

Issue 274067: Add string16 support for LowerCaseEqualsASCII, StartsWith, and EndsWith.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 2 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/string_util.cc » ('j') | base/string_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_util.h
===================================================================
--- base/string_util.h (revision 29143)
+++ base/string_util.h (working copy)
@@ -251,6 +251,7 @@
// borrowed from the equivalent APIs in Mozilla.
bool LowerCaseEqualsASCII(const std::string& a, const char* b);
bool LowerCaseEqualsASCII(const std::wstring& a, const char* b);
+bool LowerCaseEqualsASCII(const string16& a, const char* b);
// Same thing, but with string iterators instead.
bool LowerCaseEqualsASCII(std::string::const_iterator a_begin,
@@ -259,12 +260,18 @@
bool LowerCaseEqualsASCII(std::wstring::const_iterator a_begin,
std::wstring::const_iterator a_end,
const char* b);
+bool LowerCaseEqualsASCII(string16::const_iterator a_begin,
+ string16::const_iterator a_end,
+ const char* b);
bool LowerCaseEqualsASCII(const char* a_begin,
const char* a_end,
const char* b);
bool LowerCaseEqualsASCII(const wchar_t* a_begin,
const wchar_t* a_end,
const char* b);
+bool LowerCaseEqualsASCII(const char16* a_begin,
+ const char16* a_end,
+ const char* b);
// Performs a case-sensitive string compare. The behavior is undefined if both
// strings are not ASCII.
@@ -277,11 +284,17 @@
bool StartsWith(const std::wstring& str,
const std::wstring& search,
bool case_sensitive);
+bool StartsWith(const string16& str,
+ const string16& search,
+ bool case_sensitive);
// Returns true if str ends with search, or false otherwise.
bool EndsWith(const std::wstring& str,
const std::wstring& search,
bool case_sensitive);
+bool EndsWith(const string16& str,
+ const string16& search,
+ bool case_sensitive);
// Determines the type of ASCII character, independent of locale (the C
@@ -467,6 +480,8 @@
template<typename Char> struct CaseInsensitiveCompare {
public:
bool operator()(Char x, Char y) const {
+ // TODO(darin): Do we really want to do locale sensitive comparisons here?
+ // See http://crbug.com/24917
return tolower(x) == tolower(y);
}
};
« no previous file with comments | « no previous file | base/string_util.cc » ('j') | base/string_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698