Index: include/core/SkString.h |
diff --git a/include/core/SkString.h b/include/core/SkString.h |
index 9229d808a63d00ab79e758d249f5cd08952daf41..93514f2659febb67a6588cdc214595f278c825a4 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); |
} |
+enum SkStrSplitMode { |
+ // Strictly return all results. If the input is ",," and the separator is ',' this will return |
+ // an array of three empty strings. |
+ kStrict_SkStrSplitMode, |
+ |
+ // 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. |
+ kCoalesce_SkStrSplitMode |
+}; |
+ |
// 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, SkStrSplitMode splitMode, |
+ SkTArray<SkString>* out); |
+inline void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out) { |
+ SkStrSplit(str, delimiters, kCoalesce_SkStrSplitMode, out); |
+} |
#endif |