当前位置:网站首页>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
边栏推荐
- 2021 RoboCom 世界机器人开发者大赛-本科组初赛
- Yunxin small class | common cognitive misunderstandings in IM and audio and video
- 每日三题 6.30(2)
- Create Ca and issue certificate through go language
- 每日三题 6.29
- Future trend and development of neural network Internet of things
- 每日三题 6.30
- 2022年最佳智能家居开源系统:Alexa、Home Assistant、HomeKit生态系统介绍
- flutter Unable to load asset: assets/images/888. png
- Commemorate becoming the first dayus200 tripartite demo contributor
猜你喜欢
2021 RoboCom 世界机器人开发者大赛-高职组复赛
The best smart home open source system in 2022: introduction to Alexa, home assistant and homekit ecosystem
2022年R1快开门式压力容器操作考题及答案
2022年起重机司机(限桥式起重机)考试试题及模拟考试
What is the mosaic tailgate?
Linux foundation - centos7 offline installation of MySQL
2022安全员-C证考试题模拟考试题库及模拟考试
flutter Unable to load asset: assets/images/888.png
问题随记 —— /usr/bin/perl is needed by MySQL-server-5.1.73-1.glibc23.x86_64
Wechat personal small store one click opening assistant applet development
随机推荐
[micro service sentinel] sentinelresourceaspect details
What category does the Internet of things application technology major belong to
证券开户选哪个证券公司比较好,哪个更安全
Practical application and extension of plain framework
flutter Unable to load asset: assets/images/888. png
Three development trends of enterprise application from the perspective of the third technological revolution
Openresty load balancing
[understanding of opportunity-35]: Guiguzi - flying clamp - the art of remote connection, remote control and remote testing
Daily three questions 6.30
AirServer最新Win64位个人版投屏软件
y53.第三章 Kubernetes从入门到精通 -- ingress(二六)
The third part of the construction of the defense system of offensive and defensive exercises is the establishment of a practical security system
What are the common types of points mall games?
2021 RoboCom 世界机器人开发者大赛-高职组复赛
Why is PHP called hypertext preprocessor
MySQL -- convert rownum in Oracle to MySQL
Depth first search and breadth first search of graph traversal
Postgresql源码(58)元组拼接heap_form_tuple剖析
2022年危险化学品经营单位安全管理人员考试题及在线模拟考试
为什么PHP叫超文本预处理器