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

Unified Diff: base/strings/string_util.cc

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/strings/string_util.h ('k') | base/test/expectations/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string_util.cc
diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc
index 9bbe1cb569a9c94249f726776c8626350ca20931..5839cf2980273573d91316437bff5e48166dc8e5 100644
--- a/base/strings/string_util.cc
+++ b/base/strings/string_util.cc
@@ -334,7 +334,7 @@ STR CollapseWhitespaceT(const STR& text,
int chars_written = 0;
for (typename STR::const_iterator i(text.begin()); i != text.end(); ++i) {
- if (IsWhitespace(*i)) {
+ if (IsUnicodeWhitespace(*i)) {
if (!in_whitespace) {
// Reduce all whitespace sequences to a single space.
in_whitespace = true;
@@ -617,7 +617,16 @@ bool EndsWith(const string16& str,
CompareCase::SENSITIVE);
}
-} // namespace base
+char HexDigitToInt(wchar_t c) {
+ DCHECK(IsHexDigit(c));
+ if (c >= '0' && c <= '9')
+ return static_cast<char>(c - '0');
+ if (c >= 'A' && c <= 'F')
+ return static_cast<char>(c - 'A' + 10);
+ if (c >= 'a' && c <= 'f')
+ return static_cast<char>(c - 'a' + 10);
+ return 0;
+}
static const char* const kByteStringsUnlocalized[] = {
" B",
@@ -647,9 +656,11 @@ string16 FormatBytesUnlocalized(int64 bytes) {
kByteStringsUnlocalized[dimension]);
}
- return base::ASCIIToUTF16(buf);
+ return ASCIIToUTF16(buf);
}
+} // namespace base
+
// Runs in O(n) time in the length of |str|.
template<class StringType>
void DoReplaceSubstringsAfterOffset(StringType* str,
« no previous file with comments | « base/strings/string_util.h ('k') | base/test/expectations/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698