Skip to content
Mahmoud Ben Hassine edited this page Nov 21, 2015 · 4 revisions

cut

Synopsis

Splits a String by a delimiter and extract fields.

Parameters

Name Type Mandatory Default
delimiter String Yes N/A
field int Yes N/A

Example

Stream<String> stream = Stream.of("a;b", "c;d");

UnixStream.unixify(stream)
   .cut(";",2)
   .to(stdOut()); // prints "b", "d"

// Or

UnixStream.from(stream)
   .pipe(cut(";",2))
   .to(stdOut()); // prints "b", "d"

// Or

stream
    .map(Functions.cut(";", 2))
    .forEach(System.out::println); // prints "b", "d"
Clone this wiki locally