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

Unified Diff: base/strings/string_util.h

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
Index: base/strings/string_util.h
diff --git a/base/strings/string_util.h b/base/strings/string_util.h
index 442db8e1b434a8e001f3f0d30d6c28f7cbd92add..7b4b2193abfa4e9f5b739e11399c6650943a9770 100644
--- a/base/strings/string_util.h
+++ b/base/strings/string_util.h
@@ -148,22 +148,12 @@ BASE_EXPORT extern const char kWhitespaceASCII[];
// Null-terminated string representing the UTF-8 byte order mark.
BASE_EXPORT extern const char kUtf8ByteOrderMark[];
-} // namespace base
-
-#if defined(OS_WIN)
-#include "base/strings/string_util_win.h"
-#elif defined(OS_POSIX)
-#include "base/strings/string_util_posix.h"
-#else
-#error Define string operations appropriately for your platform
-#endif
-
// Removes characters in |remove_chars| from anywhere in |input|. Returns true
// if any characters were removed. |remove_chars| must be null-terminated.
// NOTE: Safe to use the same variable for both |input| and |output|.
-BASE_EXPORT bool RemoveChars(const base::string16& input,
- const base::char16 remove_chars[],
- base::string16* output);
+BASE_EXPORT bool RemoveChars(const string16& input,
+ const char16 remove_chars[],
+ string16* output);
BASE_EXPORT bool RemoveChars(const std::string& input,
const char remove_chars[],
std::string* output);
@@ -173,10 +163,10 @@ BASE_EXPORT bool RemoveChars(const std::string& input,
// the |replace_with| string. Returns true if any characters were replaced.
// |replace_chars| must be null-terminated.
// NOTE: Safe to use the same variable for both |input| and |output|.
-BASE_EXPORT bool ReplaceChars(const base::string16& input,
- const base::char16 replace_chars[],
- const base::string16& replace_with,
- base::string16* output);
+BASE_EXPORT bool ReplaceChars(const string16& input,
+ const char16 replace_chars[],
+ const string16& replace_with,
+ string16* output);
BASE_EXPORT bool ReplaceChars(const std::string& input,
const char replace_chars[],
const std::string& replace_with,
@@ -185,9 +175,9 @@ BASE_EXPORT bool ReplaceChars(const std::string& input,
// Removes characters in |trim_chars| from the beginning and end of |input|.
// |trim_chars| must be null-terminated.
// NOTE: Safe to use the same variable for both |input| and |output|.
-BASE_EXPORT bool TrimString(const base::string16& input,
- const base::char16 trim_chars[],
- base::string16* output);
+BASE_EXPORT bool TrimString(const string16& input,
+ const char16 trim_chars[],
+ string16* output);
BASE_EXPORT bool TrimString(const std::string& input,
const char trim_chars[],
std::string* output);
@@ -198,6 +188,16 @@ BASE_EXPORT void TruncateUTF8ToByteSize(const std::string& input,
const size_t byte_size,
std::string* output);
+} // namespace base
+
+#if defined(OS_WIN)
+#include "base/strings/string_util_win.h"
+#elif defined(OS_POSIX)
+#include "base/strings/string_util_posix.h"
+#else
+#error Define string operations appropriately for your platform
+#endif
+
// Trims any whitespace from either end of the input string. Returns where
// whitespace was found.
// The non-wide version has two functions:

Powered by Google App Engine
This is Rietveld 408576698