summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 21:50:53 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 21:50:53 +0000
commita8f914871101974a4856248630c08454b7a7d294 (patch)
tree322d2cf9c312b7ad60103c59bad660fab187e204 /base
parentb38f85b26762e22775e63618f005d6c55a29ef43 (diff)
downloadchromium_src-a8f914871101974a4856248630c08454b7a7d294.zip
chromium_src-a8f914871101974a4856248630c08454b7a7d294.tar.gz
chromium_src-a8f914871101974a4856248630c08454b7a7d294.tar.bz2
Properly convert from UTF8 to UTF16 in WebTextInputImpl.
String util changes by darin@chromium.org. BUG=11699 Review URL: http://codereview.chromium.org/115215 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/string_util.cc6
-rw-r--r--base/string_util.h4
2 files changed, 10 insertions, 0 deletions
diff --git a/base/string_util.cc b/base/string_util.cc
index 2e6f7b3..ea4f91e 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -734,6 +734,12 @@ bool LowerCaseEqualsASCII(const wchar_t* a_begin,
return DoLowerCaseEqualsASCII(a_begin, a_end, b);
}
+bool EqualsASCII(const string16& a, const StringPiece& b) {
+ if (a.length() != b.length())
+ return false;
+ return std::equal(a.begin(), a.end(), b.begin());
+}
+
bool StartsWithASCII(const std::string& str,
const std::string& search,
bool case_sensitive) {
diff --git a/base/string_util.h b/base/string_util.h
index c32bef3..84cb6e5 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -316,6 +316,10 @@ bool LowerCaseEqualsASCII(const wchar_t* a_begin,
const wchar_t* a_end,
const char* b);
+// Performs a case-sensitive string compare. The behavior is undefined if both
+// strings are not ASCII.
+bool EqualsASCII(const string16& a, const StringPiece& b);
+
// Returns true if str starts with search, or false otherwise.
bool StartsWithASCII(const std::string& str,
const std::string& search,