| Modifier and Type | Method and Description |
|---|---|
Splitter |
ignoreEmptyStrings()
Returns a new
Splitter that will behave as this one except
that it will ignore empty results. |
Splitter |
ignorePrefix(String prefix)
Returns a new
Splitter that will behave as this one except
that it will ignore the given prefix. |
Splitter |
ignoreSuffix(String suffix)
Returns a new
Splitter that will behave as this one except
that it will ignore the given suffix. |
Splitter |
limit(int limit)
Returns a new
Splitter that will behave as this one except
that it will limit the number of times the splitting pattern is
applied. |
static Splitter |
on(Pattern pattern)
Returns a new
Splitter that will use the specified pattern
to split Strings. |
static Splitter |
on(String separator)
Returns a new
Splitter that will use the specified separator
to split Strings. |
Splitter |
replaceEmptyStringWith(String forEmpty)
Returns a new
Splitter that will behave as this one except
that it will replace empty results by the specified String. |
List<String> |
split(String s)
Splits the given
String into parts according to its
configuration. |
Splitter |
trimResults()
Returns a new
Splitter that will behave as this one except
that it will trim splitting results. |
public static Splitter on(String separator)
Splitter that will use the specified separator
to split Strings.separator - the separator.Splitter.NullPointerException - if separator is null.public static Splitter on(Pattern pattern)
Splitter that will use the specified pattern
to split Strings.pattern - the separator pattern.Splitter.NullPointerException - if pattern is null.public Splitter limit(int limit)
Splitter that will behave as this one except
that it will limit the number of times the splitting pattern is
applied. If limit is strictly positive, then the pattern will
be applied at most limit - 1 times. If limit is
non-positive then the splitting pattern will be applied as many times
as possible.limit - the splitting limit.Splitter with the desired configuration.public Splitter trimResults()
Splitter that will behave as this one except
that it will trim splitting results.Splitter with the desired configuration.public Splitter ignorePrefix(String prefix)
Splitter that will behave as this one except
that it will ignore the given prefix.prefix - the prefix to ignore.Splitter with the desired configuration.NullPointerException - if prefix is null.public Splitter ignoreSuffix(String suffix)
Splitter that will behave as this one except
that it will ignore the given suffix.suffix - the suffix to ignore.Splitter with the desired configuration.NullPointerException - if suffix is null.public Splitter ignoreEmptyStrings()
Splitter that will behave as this one except
that it will ignore empty results.Splitter with the desired configuration.public Splitter replaceEmptyStringWith(String forEmpty)
Splitter that will behave as this one except
that it will replace empty results by the specified String.forEmpty - the value to use for empty Strings.Splitter with the desired configuration.public List<String> split(String s)
String into parts according to its
configuration.s - the String to split.List.NullPointerException - if s is null.Copyright © 2012–2015. All rights reserved.