当前位置:网站首页>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


边栏推荐
猜你喜欢

Redis RDB快照

Stm32f030f4 drives tim1637 nixie tube chip

CKS CKA ckad change terminal to remote desktop

物联网开发零基础教程

MT manager test skiing Adventure
![[micro service sentinel] sentinel integrates openfeign](/img/8b/46156255fd980eb422c7e05d5af7ee.png)
[micro service sentinel] sentinel integrates openfeign

2021 RoboCom 世界机器人开发者大赛-高职组初赛

Matplotlib common charts

flutter Unable to load asset: assets/images/888. png

What is the mosaic tailgate?
随机推荐
Win 10 mstsc connect RemoteApp
【C#】依赖注入及Autofac
内存泄露和内存溢出的区别是什么?
How to display real-time 2D map after rviz is opened
2022 safety officer-c certificate examination question simulation examination question bank and simulation examination
证券开户选哪个证券公司比较好,哪个更安全
问题随记 —— /usr/bin/perl is needed by MySQL-server-5.1.73-1.glibc23.x86_64
Current situation and future development trend of Internet of things
What professional classification does the application of Internet of things technology belong to
Microservice stability management
typescript枚举
Oracle中已定义者身份执行函数AUTHID DEFINER与Postgresql行为的异同
有没有一段代码,让你为人类的智慧所折服
想请教股票开户要认识谁?在线开户是安全么?
每日三题 6.28
Redis~02 cache: how to ensure data consistency in MySQL and redis when updating data?
[must] bm41 output the right view of the binary tree [medium +]
纪念成为首个DAYUs200三方demo贡献者
[micro service sentinel] @sentinelresource details
SWT / anr problem - SWT causes kernel fuse deadlock