StringUtils.isBlank()
时间: 2023-05-27 07:02:25 浏览: 141
The `StringUtils.isBlank()` method is a part of the Apache Commons Lang library that checks if a given string is null or empty (length of 0) or contains only white space characters. The method returns a boolean value `true` if the string meets any of these conditions and `false` otherwise. Here's an example:
```
import org.apache.commons.lang3.StringUtils;
public class StringUtilsExample {
public static void main(String[] args) {
String str1 = null;
String str2 = "";
String str3 = " ";
String str4 = "hello world";
System.out.println(StringUtils.isBlank(str1)); // true
System.out.println(StringUtils.isBlank(str2)); // true
System.out.println(StringUtils.isBlank(str3)); // true
System.out.println(StringUtils.isBlank(str4)); // false
}
}
```
阅读全文