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

Unified Diff: third_party/crashpad/crashpad/util/string/split_string.cc

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month 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
Index: third_party/crashpad/crashpad/util/string/split_string.cc
diff --git a/third_party/crashpad/crashpad/util/string/split_string.cc b/third_party/crashpad/crashpad/util/string/split_string.cc
index 25048b5636d7fe9d4be2a1b76f6a80f9bd40f15a..9d0d675aa99cb45656bc97d0b7af540df6304aa1 100644
--- a/third_party/crashpad/crashpad/util/string/split_string.cc
+++ b/third_party/crashpad/crashpad/util/string/split_string.cc
@@ -18,10 +18,10 @@
namespace crashpad {
-bool SplitString(const std::string& string,
- char delimiter,
- std::string* left,
- std::string* right) {
+bool SplitStringFirst(const std::string& string,
+ char delimiter,
+ std::string* left,
+ std::string* right) {
size_t delimiter_pos = string.find(delimiter);
if (delimiter_pos == 0 || delimiter_pos == std::string::npos) {
return false;
@@ -32,4 +32,27 @@ bool SplitString(const std::string& string,
return true;
}
+std::vector<std::string> SplitString(const std::string& str, char delimiter) {
+ std::vector<std::string> result;
+ if (str.empty())
+ return result;
+
+ size_t start = 0;
+ while (start != std::string::npos) {
+ size_t end = str.find_first_of(delimiter, start);
+
+ std::string part;
+ if (end == std::string::npos) {
+ part = str.substr(start);
+ start = std::string::npos;
+ } else {
+ part = str.substr(start, end - start);
+ start = end + 1;
+ }
+
+ result.push_back(part);
+ }
+ return result;
+}
+
} // namespace crashpad

Powered by Google App Engine
This is Rietveld 408576698