Commit 793242a3 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Have StringSplit and JoinString Refer To Each Other in Comments

This makes finding the inverse operation easier since the Join and
Split operations are defined in two different header files.

BUG=

Change-Id: I86ed3fb360737d3c2fed14edcff59afa0bbac05b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948241
Commit-Queue: Robert Liao <robliao@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721692}
parent 3b7480d4
...@@ -40,6 +40,8 @@ enum SplitResult { ...@@ -40,6 +40,8 @@ enum SplitResult {
// Split the given string on ANY of the given separators, returning copies of // Split the given string on ANY of the given separators, returning copies of
// the result. // the result.
// //
// Note this is inverse of JoinString() defined in string_util.h.
//
// To split on either commas or semicolons, keeping all whitespace: // To split on either commas or semicolons, keeping all whitespace:
// //
// std::vector<std::string> tokens = base::SplitString( // std::vector<std::string> tokens = base::SplitString(
...@@ -61,6 +63,8 @@ BASE_EXPORT std::vector<string16> SplitString(StringPiece16 input, ...@@ -61,6 +63,8 @@ BASE_EXPORT std::vector<string16> SplitString(StringPiece16 input,
// careful to keep the original string unmodified, this provides an efficient // careful to keep the original string unmodified, this provides an efficient
// way to iterate through tokens in a string. // way to iterate through tokens in a string.
// //
// Note this is inverse of JoinString() defined in string_util.h.
//
// To iterate through all whitespace-separated tokens in an input string: // To iterate through all whitespace-separated tokens in an input string:
// //
// for (const auto& cur : // for (const auto& cur :
......
...@@ -486,9 +486,11 @@ BASE_EXPORT void ReplaceSubstringsAfterOffset( ...@@ -486,9 +486,11 @@ BASE_EXPORT void ReplaceSubstringsAfterOffset(
BASE_EXPORT char* WriteInto(std::string* str, size_t length_with_null); BASE_EXPORT char* WriteInto(std::string* str, size_t length_with_null);
BASE_EXPORT char16* WriteInto(string16* str, size_t length_with_null); BASE_EXPORT char16* WriteInto(string16* str, size_t length_with_null);
// Does the opposite of SplitString()/SplitStringPiece(). Joins a vector or list // Joins a vector or list of strings into a single string, inserting |separator|
// of strings into a single string, inserting |separator| (which may be empty) // (which may be empty) in between all elements.
// in between all elements. //
// Note this is inverse of SplitString()/SplitStringPiece() defined in
// string_split.h.
// //
// If possible, callers should build a vector of StringPieces and use the // If possible, callers should build a vector of StringPieces and use the
// StringPiece variant, so that they do not create unnecessary copies of // StringPiece variant, so that they do not create unnecessary copies of
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment