当前位置:网站首页>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
/isBlank
Extérieur,Je ne savais pas qu'il y avaitisAnyEmpty
/isNoneEmpty
/isAnyBlank
/isNoneBlank
L'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
边栏推荐
- 【历史上的今天】6 月 13 日:分组交换网路的“亲子纠纷”;博弈论创始人出生;交互式电视初现雏形
- 数据清洗工具flashtext,效率直接提升了几十倍数
- 把腾讯搬上云:云服务器 CVM 的半部进化史
- How does win11 add printers and scanners? Win11 add printer and scanner settings
- 4G-learn from great partners
- 【历史上的今天】5 月 31 日:Amiga 之父诞生;BASIC 语言的共同开发者出生;黑莓 BBM 停运
- MFC常用 当前路径
- 4G-learn from great partners
- Teach you how to realize pynq-z2 bar code recognition
- [cloud native] - docker installation and deployment of distributed database oceanbase
猜你喜欢
How to enable multi language text suggestions? Win11 method to open multilingual text suggestions
数据清洗工具flashtext,效率直接提升了几十倍数
High reliability application knowledge map of Architecture -- the path of architecture evolution
Domain Name System
[today in history] May 29: the pioneer of sharing software was born; Chromebox launched; VoodooPC founder was born
Wangxinling, tanweiwei Shanhai (extended version of Chorus) online audition lossless FLAC Download
Win11新建不了文本文档?Win11右键无法新建文本文档的解决方法
Win11 ne peut pas faire glisser l'image sur le logiciel de la barre des tâches
How does win11 close recently opened projects? Win11 method to close recently opened projects
如何系统学习LabVIEW?
随机推荐
毕业季来临,2022届高校毕业生人数首次突破千万大关
How does win11 close recently opened projects? Win11 method to close recently opened projects
架构高可靠性应用知识图谱 ----- 微服务架构图谱
【历史上的今天】6 月 7 日:Kubernetes 开源版本发布;《魔兽世界》登陆中国;分组交换网络发明者出生
MySQL optimization tips
Mysql数据库基础:DML数据操作语言
简单文件传输协议TFTP
设计电商秒杀系统
数仓的字符截取三胞胎:substrb、substr、substring
win11如何添加打印机和扫描仪?win11添加打印机和扫描仪的设置
数智学习|湖仓一体实践与探索
【历史上的今天】6 月 17 日:术语“超文本”的创造者出生;Novell 首席科学家诞生;探索频道开播
MySQL优化小技巧
Desai wisdom number - histogram (column folding mixed graph): ratio of rental price to rental income in the graduation quarter of 2021
"Dadao Zhichuang" won a ten million prea+ round of financing and launched a technology consumption robot
面试:List 如何根据对象的属性去重?
fiddle如何使用代理
What if win11 can't drag an image to the taskbar software to open it quickly
How to enable multi language text suggestions? Win11 method to open multilingual text suggestions
【历史上的今天】6 月 6 日:世界 IPv6 启动纪念日;《俄罗斯方块》发布;小红书成立