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

Unified Diff: base/strings/string_util.h

Issue 296593003: Make various string_util functions take StringPieces instead of char[]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resync Created 6 years, 7 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 | « apps/app_window.cc ('k') | base/strings/string_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string_util.h
diff --git a/base/strings/string_util.h b/base/strings/string_util.h
index 9478a0c475c2910abdb6bd187b0601ce6cfc63d5..a573e227df96f6d83ff9febd7695a8a75c854138 100644
--- a/base/strings/string_util.h
+++ b/base/strings/string_util.h
@@ -150,10 +150,10 @@ BASE_EXPORT extern const char kUtf8ByteOrderMark[];
// 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
@@ -162,11 +162,11 @@ BASE_EXPORT bool RemoveChars(const std::string& input,
// |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);
@@ -174,10 +174,10 @@ BASE_EXPORT bool ReplaceChars(const std::string& input,
// |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
@@ -378,12 +378,12 @@ BASE_EXPORT base::string16 FormatBytesUnlocalized(int64 bytes);
// |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);
@@ -395,14 +395,13 @@ BASE_EXPORT void ReplaceFirstSubstringAfterOffset(
// 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
« no previous file with comments | « apps/app_window.cc ('k') | base/strings/string_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698