Index: base/strings/string_split.h |
diff --git a/base/strings/string_split.h b/base/strings/string_split.h |
index 2a0c79561b85cca9561bbc80cf8e709e7ed2eace..e4574bac52f50e836ce52b4488b0e6321d06b5bb 100644 |
--- a/base/strings/string_split.h |
+++ b/base/strings/string_split.h |
@@ -101,6 +101,23 @@ BASE_EXPORT void SplitStringUsingSubstr(StringPiece input, |
StringPiece delimiter, |
std::vector<std::string>* result); |
+// Like SplitStringUsingSubstr above except it returns a vector of StringPieces |
+// which reference the original buffer without copying. Although you have to be |
+// careful to keep the original string unmodified, this provides an efficient |
+// way to iterate through tokens in a string. |
+// |
+// To iterate through all newline-separated tokens in an input string: |
+// |
+// for (const auto& cur : |
+// base::SplitStringUsingSubstr(input, "\r\n")) { |
+// ... |
+BASE_EXPORT std::vector<StringPiece16> SplitStringPieceUsingSubstr( |
brettw
2015/12/29 22:14:40
I'd like to make this a mirror of SplitString[Piec
|
+ StringPiece16 input, |
+ StringPiece16 delimiter); |
+BASE_EXPORT std::vector<StringPiece> SplitStringPieceUsingSubstr( |
+ StringPiece input, |
+ StringPiece delimiter); |
+ |
} // namespace base |
#endif // BASE_STRINGS_STRING_SPLIT_H_ |