| Index: base/strings/string_util.h
|
| diff --git a/base/strings/string_util.h b/base/strings/string_util.h
|
| index e5cce8fd97e56f93e0717250b2b4bb60851c4806..35b2603786e7d6190922bc9af5ef6c3cb17fe389 100644
|
| --- a/base/strings/string_util.h
|
| +++ b/base/strings/string_util.h
|
| @@ -12,6 +12,7 @@
|
| #include <stddef.h>
|
| #include <stdint.h>
|
|
|
| +#include <initializer_list>
|
| #include <string>
|
| #include <vector>
|
|
|
| @@ -429,11 +430,30 @@ BASE_EXPORT char16* WriteInto(string16* str, size_t length_with_null);
|
| BASE_EXPORT wchar_t* WriteInto(std::wstring* str, size_t length_with_null);
|
| #endif
|
|
|
| -// Does the opposite of SplitString().
|
| +// Does the opposite of SplitString()/SplitStringPiece(). Joins a vector or list
|
| +// of strings into a single string, inserting |separator| (which may be empty)
|
| +// in between all elements.
|
| +//
|
| +// If possible, callers should build a vector of StringPieces and use the
|
| +// StringPiece variant, so that they do not create unnecessary copies of
|
| +// strings. For example, instead of using SplitString, modifying the vector,
|
| +// then using JoinString, use SplitStringPiece followed by JoinString so that no
|
| +// copies of those strings are created until the final join operation.
|
| BASE_EXPORT std::string JoinString(const std::vector<std::string>& parts,
|
| StringPiece separator);
|
| BASE_EXPORT string16 JoinString(const std::vector<string16>& parts,
|
| StringPiece16 separator);
|
| +BASE_EXPORT std::string JoinString(const std::vector<StringPiece>& parts,
|
| + StringPiece separator);
|
| +BASE_EXPORT string16 JoinString(const std::vector<StringPiece16>& parts,
|
| + StringPiece16 separator);
|
| +// Explicit initializer_list overloads are required to break ambiguity when used
|
| +// with a literal initializer list (otherwise the compiler would not be able to
|
| +// decide between the string and StringPiece overloads).
|
| +BASE_EXPORT std::string JoinString(std::initializer_list<StringPiece> parts,
|
| + StringPiece separator);
|
| +BASE_EXPORT string16 JoinString(std::initializer_list<StringPiece16> parts,
|
| + StringPiece16 separator);
|
|
|
| // Replace $1-$2-$3..$9 in the format string with values from |subst|.
|
| // Additionally, any number of consecutive '$' characters is replaced by that
|
|
|