// 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 string16& input,
- const char16 remove_chars[],
+ const base::StringPiece16& remove_chars,
string16* output);
BASE_EXPORT bool RemoveChars(const std::string& input,
- const char remove_chars[],
+ const base::StringPiece& remove_chars,
std::string* output);
// Replaces characters in |replace_chars| from anywhere in |input| with
// |replace_chars| must be null-terminated.
// NOTE: Safe to use the same variable for both |input| and |output|.
BASE_EXPORT bool ReplaceChars(const string16& input,
- const char16 replace_chars[],
+ const base::StringPiece16& replace_chars,
const string16& replace_with,
string16* output);
BASE_EXPORT bool ReplaceChars(const std::string& input,
- const char replace_chars[],
+ const base::StringPiece& replace_chars,
const std::string& replace_with,
std::string* output);
// |trim_chars| must be null-terminated.
// NOTE: Safe to use the same variable for both |input| and |output|.
BASE_EXPORT bool TrimString(const string16& input,
- const char16 trim_chars[],
+ const base::StringPiece16& trim_chars,
string16* output);
BASE_EXPORT bool TrimString(const std::string& input,
- const char trim_chars[],
+ const base::StringPiece& trim_chars,
std::string* output);
// Truncates a string to the nearest UTF-8 character that will leave
BASE_EXPORT bool IsStringASCII(const StringPiece& str);
BASE_EXPORT bool IsStringASCII(const string16& str);
-} // 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
-
// Converts the elements of the given string. This version uses a pointer to
// clearly differentiate it from the non-pointer variant.
template <class str> inline void StringToLowerASCII(str* s) {
for (typename str::iterator i = s->begin(); i != s->end(); ++i)
- *i = base::ToLowerASCII(*i);
+ *i = ToLowerASCII(*i);
}
template <class str> inline str StringToLowerASCII(const str& s) {
return 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
+
// Converts the elements of the given string. This version uses a pointer to
// clearly differentiate it from the non-pointer variant.
template <class str> inline void StringToUpperASCII(str* s) {
// |find_this| with |replace_with|.
BASE_EXPORT void ReplaceFirstSubstringAfterOffset(
base::string16* str,
- base::string16::size_type start_offset,
+ size_t start_offset,
const base::string16& find_this,
const base::string16& replace_with);
BASE_EXPORT void ReplaceFirstSubstringAfterOffset(
std::string* str,
- std::string::size_type start_offset,
+ size_t start_offset,
const std::string& find_this,
const std::string& replace_with);
// std::replace(str.begin(), str.end(), 'a', 'b');
BASE_EXPORT void ReplaceSubstringsAfterOffset(
base::string16* str,
- base::string16::size_type start_offset,
+ size_t start_offset,
const base::string16& find_this,
const base::string16& replace_with);
-BASE_EXPORT void ReplaceSubstringsAfterOffset(
- std::string* str,
- std::string::size_type start_offset,
- const std::string& find_this,
- const std::string& replace_with);
+BASE_EXPORT void ReplaceSubstringsAfterOffset(std::string* str,
+ size_t start_offset,
+ const std::string& find_this,
+ const std::string& replace_with);
// Reserves enough memory in |str| to accommodate |length_with_null| characters,
// sets the size of |str| to |length_with_null - 1| characters, and returns a