MINOR: ist: Add `istsplit(struct ist*, char)`
istsplit is a combination of iststop + istadv.
diff --git a/include/import/ist.h b/include/import/ist.h
index 6ece7cd..daf23d5 100644
--- a/include/import/ist.h
+++ b/include/import/ist.h
@@ -801,6 +801,20 @@
return ist2(ist.ptr + nb, ist.len - nb);
}
+/* Splits the given <ist> at the given character. The returned ist is
+ * equivalent to iststop(ist, delim). The passed <ist> will contain the
+ * remainder of the string, not including the delimiter. In other words
+ * it will be advanced by the length of the returned string plus 1.
+ */
+static inline struct ist istsplit(struct ist *ist, char delim)
+{
+ const struct ist result = iststop(*ist, delim);
+
+ *ist = istadv(*ist, result.len + 1);
+
+ return result;
+}
+
/*
* compare 2 ists and return non-zero if they are the same
*/