Skip to content
Mahmoud Ben Hassine edited this page Oct 9, 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");

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

// Or

XStream.from(stream)
   .pipe(trunc(2))
   .to(stdOut()); // prints "ab", "de"
Clone this wiki locally