当前位置:网站首页>Différences d'utilisation entre IsEmpty et isblank
Différences d'utilisation entre IsEmpty et isblank
2022-06-28 02:45:00 【Une sculpture dans le désert.】
Peut - être qu'aucun de vous ne sait,Peut - être que tu n'es pasisEmpty/isNotEmpty/isNotBlank/isBlankExtérieur,Je ne savais pas qu'il y avaitisAnyEmpty/isNoneEmpty/isAnyBlank/isNoneBlankL'existence de, come on ,Explorons ensembleorg.apache.commons.lang3.StringUtils;Cette classe d'outils.
isEmptySérie
StringUtils.isEmpty()
Est vide. Je vois. " " Les espaces contournent ce jugement vide,Parce que c'est un espace,Ce n'est pas une valeur strictement nulle,Peut conduire à isEmpty(" ")=false
StringUtils.isEmpty(null) = true
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false
StringUtils.isEmpty(“bob”) = false
StringUtils.isEmpty(" bob ") = false
/**
*
* <p>NOTE: This method changed in Lang version 2.0.
* It no longer trims the CharSequence.
* That functionality is available in isBlank().</p>
*
* @param cs the CharSequence to check, may be null
* @return {@code true} if the CharSequence is empty or null
* @since 3.0 Changed signature from isEmpty(String) to isEmpty(CharSequence)
*/
public static boolean isEmpty(final CharSequence cs) {
return cs == null || cs.length() == 0;
}
StringUtils.isNotEmpty()
équivalent à ne pas être vide , = !isEmpty()
public static boolean isNotEmpty(final CharSequence cs) {
return !isEmpty(cs);
}
StringUtils.isAnyEmpty()
Y en a - t - il un vide,Un seul est vide,C'est tout.true.
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
/**
* @param css the CharSequences to check, may be null or empty
* @return {@code true} if any of the CharSequences are empty or null
* @since 3.2
*/
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;
}
StringUtils.isNoneEmpty()
équivalent à!isAnyEmpty(css) , Toutes les valeurs doivent être non nulles pour revenirtrue
/**
* <p>Checks if none of the CharSequences are empty ("") or null.</p>
*
* <pre>
* StringUtils.isNoneEmpty(null) = false
* StringUtils.isNoneEmpty(null, "foo") = false
* StringUtils.isNoneEmpty("", "bar") = false
* StringUtils.isNoneEmpty("bob", "") = false
* StringUtils.isNoneEmpty(" bob ", null) = false
* StringUtils.isNoneEmpty(" ", "bar") = true
* StringUtils.isNoneEmpty("foo", "bar") = true
* </pre>
*
* @param css the CharSequences to check, may be null or empty
* @return {@code true} if none of the CharSequences are empty or null
* @since 3.2
*/
public static boolean isNoneEmpty(final CharSequence... css) {
isBankSérie
StringUtils.isBlank()
Est - ce une valeur de vide(Espace ou valeur vide)
StringUtils.isBlank(null) = true
StringUtils.isBlank("") = true
StringUtils.isBlank(" ") = true
StringUtils.isBlank(“bob”) = false
StringUtils.isBlank(" bob ") = false
/**
* <p>Checks if a CharSequence is whitespace, empty ("") or null.</p>
* @param cs the CharSequence to check, may be null
* @return {@code true} if the CharSequence is null, empty or whitespace
* @since 2.0
* @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence)
*/
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;
}
StringUtils.isNotBlank()
Si ce n'est vraiment pas vide,Pas un espace ou une valeur vide ,équivalent à!isBlank();
public static boolean isNotBlank(final CharSequence cs) {
return !isBlank(cs);
}
StringUtils.isAnyBlank()
Y a - t - il des valeurs de vide(Contient des espaces ou des valeurs vides)
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
/**
* <p>Checks if any one of the CharSequences are blank ("") or null and not whitespace only..</p>
* @param css the CharSequences to check, may be null or empty
* @return {@code true} if any of the CharSequences are blank or null or whitespace only
* @since 3.2
*/
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;
}
StringUtils.isNoneBlank()
Est - ce qu'aucun ne contient de valeurs vides ou d'espaces
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
/**
* <p>Checks if none of the CharSequences are blank ("") or null and whitespace only..</p>
* @param css the CharSequences to check, may be null or empty
* @return {@code true} if none of the CharSequences are blank or null or whitespace only
* @since 3.2
*/
public static boolean isNoneBlank(final CharSequence... css) {
return !isAnyBlank(css);
}
StringUtilsAutres méthodes
Voir la documentation officielle ,Il y a une description détaillée, Certaines méthodes sont encore très utiles .
https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html


边栏推荐
- Low code solution - a low code solution for digital after-sales service covering the whole process of work order, maintenance and Finance
- How to realize red, green and yellow traffic lights in ros+gazebo?
- JS实现滑动拼图验证
- Is it safe for qiniu to open an account? How do I open an account online?
- 毕业季来临,2022届高校毕业生人数首次突破千万大关
- 【历史上的今天】6 月 1 日:Napster 成立;MS-DOS 原作者出生;谷歌出售 Google SketchUp
- A low-cost method to increase private domain traffic with simple maintenance
- Dynamic Host Configuration Protocol
- Mysql数据库基础:DML数据操作语言
- Exploration on the construction path of real-time digital warehouse integrating digital intelligence learning and streaming batch
猜你喜欢

【历史上的今天】6 月 2 日:苹果推出了 Swift 编程语言;电信收购联通 C 网;OS X Yosemite 发布

ScheduledThreadPoolExecutor源码解读(二)

【历史上的今天】6 月 19 日:iPhone 3GS 上市;帕斯卡诞生;《反恐精英》开始测试

低代码DSL里面在数仓中的实践

把腾讯搬上云:云服务器 CVM 的半部进化史

Unity WebGL打包后怎么运行(火狐配置)

数智学习|湖仓一体实践与探索

From how to use to how to implement a promise

Cloud native (30) | kubernetes' app store Helm

【二维码图像矫正增强】基于MATLAB的二维码图像矫正增强处理仿真
随机推荐
投资同业存单基金是靠谱吗,同业存单基金安全吗
【 amélioration de la correction d'image de Code bidimensionnel】 simulation du traitement d'amélioration de la correction d'image de Code bidimensionnel basée sur MATLAB
【历史上的今天】6 月 19 日:iPhone 3GS 上市;帕斯卡诞生;《反恐精英》开始测试
【历史上的今天】6 月 6 日:世界 IPv6 启动纪念日;《俄罗斯方块》发布;小红书成立
[2D code image correction and enhancement] simulation of 2D code image correction and enhancement processing based on MATLAB
毕业总结
Opencv——霍夫变换以及遇到的一些问题
[today in history] May 29: the pioneer of sharing software was born; Chromebox launched; VoodooPC founder was born
Starting sequence of Turing machine
SQL reported an unusual error, which confused the new interns
Data governance and data standards
LeetCode - Easy - 197
【历史上的今天】6 月 5 日:洛夫莱斯和巴贝奇相遇;公钥密码学先驱诞生;函数语言设计先驱出生
How does win11 add printers and scanners? Win11 add printer and scanner settings
毕业季来临,2022届高校毕业生人数首次突破千万大关
Unity WebGL打包后怎么运行(火狐配置)
一种低成本增长私域流量,且维护简单的方法
How to realize red, green and yellow traffic lights in ros+gazebo?
Win11不能拖拽圖片到任務欄軟件上快速打開怎麼辦
Desai wisdom number - histogram (column folding mixed graph): ratio of rental price to rental income in the graduation quarter of 2021