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


边栏推荐
- Digital intelligence learning Lake Warehouse Integration Practice and exploration
- 【历史上的今天】6 月 2 日:苹果推出了 Swift 编程语言;电信收购联通 C 网;OS X Yosemite 发布
- [today in history] June 1: Napster was founded; MS-DOS original author was born; Google sells Google SketchUp
- Opencv——霍夫变换以及遇到的一些问题
- "Dadao Zhichuang" won a ten million prea+ round of financing and launched a technology consumption robot
- Stm32f1 interrupt introduction
- Dynamic Host Configuration Protocol
- Keil "St link USB communication error" solution
- Protocole de transfert de fichiers - - FTP
- [block coding] simulation of image block coding based on MATLAB
猜你喜欢

Exploration on the construction path of real-time digital warehouse integrating digital intelligence learning and streaming batch

The graduation season is coming, and the number of college graduates in 2022 has exceeded 10 million for the first time

【模糊神经网络】基于matlab的模糊神经网络仿真

SQL injection bypass (V)

High reliability application knowledge map of Architecture -- the path of architecture evolution

Mysql大合集,你要内容的这里全都有

MySQL optimization tips

How does win11 close recently opened projects? Win11 method to close recently opened projects

Interpretation of the source code of scheduledthreadpoolexecutor (II)

数据治理与数据标准
随机推荐
Stm32f1 and stm32subeide programming example - metal touch sensor driver
Win11 ne peut pas faire glisser l'image sur le logiciel de la barre des tâches
云原生(三十) | Kubernetes篇之应用商店-Helm
"Dadao Zhichuang" won a ten million prea+ round of financing and launched a technology consumption robot
如何开启多语言文本建议?Win11打开多语言文本建议的方法
[elevator control system] design of elevator control system based on VHDL language and state machine, using state machine
毕业总结
如何系统学习LabVIEW?
Prometheus 2.27.0 新特性
英特尔锐炫A380显卡即将在中国面市
Keil "St link USB communication error" solution
Protocole de transfert de fichiers - - FTP
【二维码图像矫正增强】基于MATLAB的二维码图像矫正增强处理仿真
[today in history] May 29: the pioneer of sharing software was born; Chromebox launched; VoodooPC founder was born
How to realize red, green and yellow traffic lights in ros+gazebo?
【历史上的今天】6 月 1 日:Napster 成立;MS-DOS 原作者出生;谷歌出售 Google SketchUp
【历史上的今天】6 月 17 日:术语“超文本”的创造者出生;Novell 首席科学家诞生;探索频道开播
Snake C language
转载文章:数字经济催生强劲算力需求 英特尔发布多项创新技术挖掘算力潜能
面试:Bitmap像素内存分配在堆内存还是在native中