当前位置:网站首页>Notblank and notempty
Notblank and notempty
2022-07-01 23:30:00 【Jingling cat】
lang and lang3 In bag StringUtils The difference between
public interface CharSequence {
}
public final class String implements java.io.Serializable, Comparable<String>, CharSequence {
}
commons-lang Official documents


isEmpty series
isEmpty
StringUtils.isEmpty(null) = true
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false // Note that there
StringUtils.isEmpty(“bob”) = false
StringUtils.isEmpty(" bob ") = false
public static boolean isEmpty(final CharSequence cs) {
return cs == null || cs.length() == 0;
}
isNotEmpty()
public static boolean isNotEmpty(final CharSequence cs) {
return !isEmpty(cs);
}
StringUtils.isAnyEmpty()
StringUtils.isAnyEmpty(null) = true
StringUtils.isAnyEmpty(null, “foo”) = true
StringUtils.isAnyEmpty("", “bar”) = true
StringUtils.isAnyEmpty(“bob”, “”) = true
StringUtils.isAnyEmpty(" bob ", null) = true
StringUtils.isAnyEmpty(" ", “bar”) = false
StringUtils.isAnyEmpty(“foo”, “bar”) = false
public static boolean isAnyEmpty(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return true;
}
for (final CharSequence cs : css){
if (isEmpty(cs)) {
return true;
}
}
return false;
}
isNoneEmpty()
public static boolean isNoneEmpty(final CharSequence... css) {
}
isBank series
isBlank() Whether it is vacuum value ( Space or null value )
StringUtils.isBlank(null) = true
StringUtils.isBlank("") = true
StringUtils.isBlank(" ") = true // Note that there
StringUtils.isBlank(“bob”) = false
StringUtils.isBlank(" bob ") = false
public static boolean isBlank(final CharSequence cs) {
int strLen;
if (cs == null || (strLen = cs.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if (Character.isWhitespace(cs.charAt(i)) == false) {
return false;
}
}
return true;
}
isNotBlank()
public static boolean isNotBlank(final CharSequence cs) {
return !isBlank(cs);
}
isAnyBlank()
StringUtils.isAnyBlank(null) = true
StringUtils.isAnyBlank(null, “foo”) = true
StringUtils.isAnyBlank(null, null) = true
StringUtils.isAnyBlank("", “bar”) = true
StringUtils.isAnyBlank(“bob”, “”) = true
StringUtils.isAnyBlank(" bob ", null) = true
StringUtils.isAnyBlank(" ", “bar”) = true
StringUtils.isAnyBlank(“foo”, “bar”) = false
public static boolean isAnyBlank(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return true;
}
for (final CharSequence cs : css){
if (isBlank(cs)) {
return true;
}
}
return false;
}
isNoneBlank()
StringUtils.isNoneBlank(null) = false
StringUtils.isNoneBlank(null, “foo”) = false
StringUtils.isNoneBlank(null, null) = false
StringUtils.isNoneBlank("", “bar”) = false
StringUtils.isNoneBlank(“bob”, “”) = false
StringUtils.isNoneBlank(" bob ", null) = false
StringUtils.isNoneBlank(" ", “bar”) = false
StringUtils.isNoneBlank(“foo”, “bar”) = true
public static boolean isNoneBlank(final CharSequence... css) {
return !isAnyBlank(css);
}
Other methods


边栏推荐
- 学成在线案例实战
- 想请教股票开户要认识谁?在线开户是安全么?
- Notes to problems - file /usr/share/mysql/charsets/readme from install of mysql-server-5.1.73-1 glibc23.x86_ 64 c
- 软件架构的本质
- Leetcode (34) -- find the first and last positions of elements in a sorted array
- URL introduction
- AirServer最新Win64位个人版投屏软件
- Redis数据类型和应用场景
- y53.第三章 Kubernetes从入门到精通 -- ingress(二六)
- De PIP. Interne. CLI. Main Import main modulenotfounderror: No module named 'PIP'
猜你喜欢

纪念成为首个DAYUs200三方demo贡献者

Redis AOF日志

Redis data types and application scenarios

2022 crane driver (limited to bridge crane) examination questions and simulation examination

Yunxin small class | common cognitive misunderstandings in IM and audio and video

2022 safety officer-c certificate examination question simulation examination question bank and simulation examination

Istio, ebpf and rsocket Broker: in depth study of service grid

Redis RDB快照

What is the mosaic tailgate?

flutter Unable to load asset: assets/images/888.png
随机推荐
dat. GUI
Daily three questions 6.30
mysql binlog的清理
The best smart home open source system in 2022: introduction to Alexa, home assistant and homekit ecosystem
Why is PHP called hypertext preprocessor
2021 RoboCom 世界机器人开发者大赛-高职组初赛
问题随记 —— /usr/bin/perl is needed by MySQL-server-5.1.73-1.glibc23.x86_64
Matplotlib common settings
字典、哈希表、数组的概念
Material Design组件 - 使用BottomSheet展现扩展内容(一)
Commemorate becoming the first dayus200 tripartite demo contributor
from pip._ internal. cli. main import main ModuleNotFoundError: No module named ‘pip‘
Istio, ebpf and rsocket Broker: in depth study of service grid
【C#】依赖注入及Autofac
每日三题 6.30(2)
What is the difference between memory leak and memory overflow?
ShanDong Multi-University Training #3
2021 RoboCom 世界机器人开发者大赛-高职组复赛
The digital summit is popular, and city chain technology has triggered a new round of business transformation
Openresty load balancing