public class StringUtils extends Object
AntPathMatcher
and BeelineServletFilter
.
NB:: This class is forked from the Spring Framework with modifications.
This was to avoid having a dependency on Spring in the core Beeline module, but also to avoid rewriting an implementation of Ant-style path pattern matching.
As per the Apache 2.0 license, the original copyright notice and all author and copyright information have remained in tact.
Constructor | Description |
---|---|
StringUtils() |
Modifier and Type | Method | Description |
---|---|---|
static boolean |
hasText(String input) |
Check whether the given
CharSequence contains actual text. |
static String[] |
tokenizeToStringArray(String str,
String delimiters,
boolean trimTokens,
boolean ignoreEmptyTokens) |
public static boolean hasText(String input)
CharSequence
contains actual text.
More specifically, this method returns true
if the
CharSequence
is not null
, its length is greater than
0, and it contains at least one non-whitespace character.
StringUtils.hasText(null) = false StringUtils.hasText("") = false StringUtils.hasText(" ") = false StringUtils.hasText("12345") = true StringUtils.hasText(" 12345 ") = true
input
- the CharSequence
to check (may be null
)true
if the CharSequence
is not null
,
its length is greater than 0, and it does not contain whitespace onlyhasText(String)
,
Character.isWhitespace(char)
public static String[] tokenizeToStringArray(String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens)
String
into a String
array via a
StringTokenizer
.
The given delimiters
string can consist of any number of
delimiter characters. Each of those characters can be used to separate
tokens. A delimiter is always a single character.
str
- the String
to tokenize (potentially null
or empty)delimiters
- the delimiter characters, assembled as a String
(each of the characters is individually considered as a delimiter)trimTokens
- trim the tokens via String.trim()
ignoreEmptyTokens
- omit empty tokens from the result array
(only applies to tokens that are empty after trimming; StringTokenizer
will not consider subsequent delimiters as token in the first place).StringTokenizer
,
String.trim()
Copyright © 2019–2020 Honeycomb. All rights reserved.