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

trunc

Synopsis

Truncates a String to a limited size.

Parameters

Name Type Mandatory Default
size int Yes N/A

Example

Stream<String> stream = Stream.of("abc", "def");

UnixStream.unixify(stream)
   .trunc(2)
   .to(stdOut()); // prints "ab", "de"

// Or

UnixStream.from(stream)
   .pipe(trunc(2))
   .to(stdOut()); // prints "ab", "de"

// Or

stream
    .map(Functions.trunc(2))
    .forEach(System.out::println); // prints "ab", "de"
Clone this wiki locally