public final class StringUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String[] |
split(String str,
char separatorChar)
Splits the provided text into an array, separator specified.
|
static boolean |
startsWithIgnoreWhitespaces(String prefix,
String string)
Tests if this string starts with the specified prefix (Ignoring whitespaces)
|
public static boolean startsWithIgnoreWhitespaces(String prefix, String string)
prefix
- string
- public static String[] split(String str, char separatorChar)
Splits the provided text into an array, separator specified. This is an alternative to using StringTokenizer.
The separator is not included in the returned String array. Adjacent separators are treated as one separator.
A null
input String returns null
.
StringUtils.split(null, *) = null StringUtils.split("", *) = [] StringUtils.split("a.b.c", '.') = ["a", "b", "c"] StringUtils.split("a..b.c", '.') = ["a", "b", "c"] StringUtils.split("a:b:c", '.') = ["a:b:c"] StringUtils.split("a\tb\nc", null) = ["a", "b", "c"] StringUtils.split("a b c", ' ') = ["a", "b", "c"]
str
- the String to parse, may be nullseparatorChar
- the character used as the delimiter,
null
splits on whitespacenull
if null String inputCopyright © 2004–2016 The Apache Software Foundation. All rights reserved.