Index: include/core/SkString.h |
diff --git a/include/core/SkString.h b/include/core/SkString.h |
index 9229d808a63d00ab79e758d249f5cd08952daf41..3389c461d43c4524d1210ea4b813e547443d9ad2 100644 |
--- a/include/core/SkString.h |
+++ b/include/core/SkString.h |
@@ -267,7 +267,22 @@ template <> inline void SkTSwap(SkString& a, SkString& b) { |
a.swap(b); |
} |
Kimmo Kinnunen
2015/12/07 09:26:48
Added these (copied chromium base/strings/string_s
|
+enum SkStrSplitResult { |
scroggo
2015/12/07 13:27:52
Naming this "Result" makes me think this will be t
Kimmo Kinnunen
2015/12/08 09:07:51
Done.
|
+ // Strictly return all results. If the input is ",," and the separator is ',' this will return |
+ // an array of three empty strings. |
+ kAll_SkStrSplitResult, |
scroggo
2015/12/07 13:27:52
I don't find these names to be very descriptive. B
Kimmo Kinnunen
2015/12/08 09:07:51
I changed them to your suggestions.
I don't neces
|
+ |
+ // Only nonempty results will be added to the results. Multiple separators will be |
+ // coalesced. Separators at the beginning and end of the input will be ignored. If the input is |
+ // ",," and the separator is ',', this will return an empty vector. |
+ kNonEmpty_SkStrSplitResult |
+}; |
+ |
// Split str on any characters in delimiters into out. (Think, strtok with a sane API.) |
-void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out); |
+void SkStrSplit(const char* str, const char* delimiters, SkStrSplitResult resultBehavior, |
+ SkTArray<SkString>* out); |
+inline void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out) { |
+ SkStrSplit(str, delimiters, kNonEmpty_SkStrSplitResult, out); |
+} |
#endif |