, String, matches(regex), , .
, ...
String emptyOrAllWhiteSpace = "^[ \t]*$";
if (name == null || name.matches(emptyOrAllWhiteSpace)) {
} else {
}
Apache Commons Lang - StringUtils.isEmpty(CharSequence), StringUtils.isWhitespace(CharSequence).
Guava has another helper Strings.isNullOrEmpty()that you can use.
source
share