The method
trimResults() returns a splitter that behaves equivalently to this splitter, but automatically removes
leading and
trailing whitespace from each returned substring. For example,
Splitter.on(', ').trimResults().split(" a, b, c ") returns an iterable containing
["a", "b", "c"].
Syntax:
public Splitter trimResults()
Return Value: This method returns a splitter with the desired configuration.
Example 1:
Output:
Hello
geeks
for
geeks
noida
Example 2: