diff --git a/src/main/java/rx/observables/StringObservable.java b/src/main/java/rx/observables/StringObservable.java index 202f008..be34757 100644 --- a/src/main/java/rx/observables/StringObservable.java +++ b/src/main/java/rx/observables/StringObservable.java @@ -357,22 +357,47 @@ public String call(Object obj) { /** * Rechunks the strings based on a regex pattern and works on infinite stream. - * + * *
      * split(["boo:an", "d:foo"], ":") --> ["boo", "and", "foo"]
      * split(["boo:an", "d:foo"], "o") --> ["b", "", ":and:f", "", ""]
      * 
- * + * * See {@link Pattern} *

* - * + * * @param src + * the source that should be use for the split * @param regex + * a string that build regular expression modifier * @return the Observable streaming the split values */ + public static Observable split(final Observable src, String regex) { - final Pattern pattern = Pattern.compile(regex); + Pattern pattern = Pattern.compile(regex); + return StringObservable.split(src,pattern); + } + + /** + * Rechunks the strings based on a regex pattern and works on infinite stream. + * + *

+     * split(["boo:an", "d:foo"], ":") --> ["boo", "and", "foo"]
+     * split(["boo:an", "d:foo"], "o") --> ["b", "", ":and:f", "", ""]
+     * 
+ * + * See {@link Pattern} + *

+ * + * + * @param src + * the source that should be use for the split + * @param pattern + * pre compiled regular expression pattern for the split functionality + * @return the Observable streaming the split values + */ + public static Observable split(final Observable src, final Pattern pattern) { return src.lift(new Operator() { @Override