summaryrefslogtreecommitdiffstats
path: root/base/string_util.h
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 23:22:56 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 23:22:56 +0000
commit24d4f62c457557c780f9ae3f712f6217e5365dcd (patch)
tree05e6ac870018c0fcf54c21673ac176d92bb03aaa /base/string_util.h
parent9b90411688764bb782a7451551d30226073b6bc0 (diff)
downloadchromium_src-24d4f62c457557c780f9ae3f712f6217e5365dcd.zip
chromium_src-24d4f62c457557c780f9ae3f712f6217e5365dcd.tar.gz
chromium_src-24d4f62c457557c780f9ae3f712f6217e5365dcd.tar.bz2
Add string16 support for LowerCaseEqualsASCII, StartsWith, and EndsWith.
R=mpcomplete BUG=none TEST=none Review URL: http://codereview.chromium.org/274067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29209 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.h')
-rw-r--r--base/string_util.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/base/string_util.h b/base/string_util.h
index 5f7afea..f1eaa4e 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -251,6 +251,7 @@ template <class str> inline str StringToUpperASCII(const str& s) {
// 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::string::const_iterator a_begin,
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 StartsWithASCII(const std::string& str,
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 @@ inline typename string_type::value_type* WriteInto(string_type* str,
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);
}
};