public final class StringSplitter extends Object
String.split(String) with Splitter| Constructor and Description |
|---|
StringSplitter() |
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
split(String toSplit,
String separator)
Provides a more reliable version of
String.split(String), using Guava's Splitter. |
static List<String> |
splitAndIgnoreEmpty(String toSplit,
String separator)
Provides a more reliable version of
String.split(String), using Guava's Splitter. |
public static List<String> split(String toSplit, String separator)
String.split(String), using Guava's Splitter.Splitter.trimResults()). If the string to
split is null or empty, an array with a single empty string will be returned. If the separator string is null
or empty, an array with a single element containing the original string will be returned.public static List<String> splitAndIgnoreEmpty(String toSplit, String separator)
String.split(String), using Guava's Splitter. This particular version also removes
any strings that are empty post-split (Splitter.omitEmptyStrings()).Splitter.trimResults()). Any strings that are
empty post-split will be removed (Splitter.omitEmptyStrings()). If the string to split is null, an array
with a single empty string will be returned. If the string to split is empty, an empty array will be returned. If the separator string
is null or empty, an array with a single element containing the original string will be returned.Copyright © 2017. All rights reserved.