代码中 isEmpty 和 isBlank 的区别
isEmpty系列
StringUtils.isEmpty()
是否为空. 可以看到 " " 空格是会绕过这种空判断,因为是一个空格,并不是严格的空值,会导致 isEmpty(" ")=false
tringUtils.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()
相当于不为空 , = !isEmpty()
public static boolean isNotEmpty(final CharSequence cs) {return !isEmpty(cs);}
StringUtils.isAnyEmpty()
是否有一个为空,只有一个为空,就为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()
相当于!isAnyEmpty(css) , 必须所有的值都不为空才返回true
/* <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) {
isBank系列
StringUtils.isBlank()
是否为真空值(空格或者空值)
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()
是否真的不为空,不是空格或者空值 ,相当于!isBlank();
public static boolean isNotBlank(final CharSequence cs) {return !isBlank(cs);}
StringUtils.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
/* <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()
是否全部都不包含空值或空格
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);
}
相关文章:
代码中 isEmpty 和 isBlank 的区别
isEmpty系列 StringUtils.isEmpty() 是否为空. 可以看到 " " 空格是会绕过这种空判断,因为是一个空格,并不是严格的空值,会导致 isEmpty(" ")false tringUtils.isEmpty(null) true StringUtils.isEmpty("") true StringUtils.isEmpty(" …...

为什么要选择文件传输软件?有哪些最佳高速文件传输软件?
是否经历过这样的场景,正在努力地完成工作任务,但是由于制作的数据无法及时传送给合作伙伴,工作流程被打断了?这听起来很令人沮丧,对吧?可是,这种情况在现实中并不罕见。 因此,需要…...

aardio + customPlus 显示图片演示
看效果: 上代码: import win.ui; /*DSG{{*/ var winform win.form(text"aardio customPlus 显示图片演示 by 光庆";right927;bottom607) winform.add( button{cls"button";text"下一页";left664;top536;right794;bott…...

收集到大量的名片怎么转为excel?
来百度APP畅享高清图片 参加完展会或集体会议,是不是收了一大堆名片,保管起来超级麻烦,还容易丢三落四?别急,我们有办法!把名片转成电子版保存到电脑上就完美啦!但要是名片数量有点多࿰…...

JAVASE---方法的使用
方法概念及使用 什么是方法(method) 方法就是一个代码片段. 类似于 C 语言中的 "函数"。方法存在的意义(不要背, 重在体会): 1. 是能够模块化的组织代码(当代码规模比较复杂的时候)。 2. 做到代码被重复使用, 一份代码可以在多个位置使用。 3. 让代码更好理解更简单…...
CryptoJS.lib.WordArray.create、CryptoJS.enc.Base64介绍
1、CryptoJS.lib.WordArray.create:它是 CryptoJS 库中的一个方法,用于创建 WordArray 对象。WordArray 对象是 CryptoJS 库中用于处理二进制数据的基本数据类型。它通常用于表示加密算法的输入和输出。 2、CryptoJS.enc.Base64:它是 CryptoJ…...
linux 配置java环境变量
单个用户 vim ~/.bashrc 或者 vim ~/.bash_profile全局用户 vim /etc/profileexport JAVA_HOME/path/to/java export PATH$JAVA_HOME/bin:$PATH立即生效使用 source 命令 source ~/.bashrc source /etc/profilejava -version...

Mybatis异常Invalid bound statement (not found)原因之Mapper文件配置不匹配
模拟登录操作 $.post("/admin/login", {aname, pwd }, rt > {if (rt.code 200) {location.href "manager/index.html";return;}alert(rt.msg)});网页提示服务器代码错误 POST http://localhost:8888/admin/login 500后端显示无法找到Mapper中对应的…...

SAP中采购文档出现定价转换因子字段溢出是何原因?
近期处理了一笔用户反馈的主题问题。这个问题有意思的地方在于,多重错误的叠加,导致了问题在开始就暴露出来,可以将隐患消除在萌芽状态。 在公司的应用中,会由采购创建价格合同,物流参照价格合同创建计划协议。但采购…...

Linux6.33 Kubernetes kubectl详解
文章目录 计算机系统5G云计算第三章 LINUX Kubernetes kubectl详解一、陈述式资源管理方法1.基本信息查看2.项目的生命周期:创建-->发布-->更新-->回滚-->删除 二、声明式管理方法 计算机系统 5G云计算 第三章 LINUX Kubernetes kubectl详解 一、陈述…...
小程序uni-select溢出文字处理方式
<uni-data-select v-model="customFormData.limitedBy" :localdata="cancelWays" @change="change"></uni-data-select>溢出效果如下图...
【MacOS】mac OS 安装HP 打印机驱动 hp laserjet m1213nf mfp
先确认一下机器复印是否正常.确认一下打印机的硬件. 如果复印没问题 1. 下载v5.1集合包Hewlett-Packard 打印机驱动程序 v5.1.1 (OS X) (中国) 2. 苹果商城中,下载Pacifist,运行Pacifist,用Pacifist程序打开v5.1并安装 3. 电脑--系统偏好设置--打印…...
【搜索】DFS剪枝与优化
算法提高课笔记 目录 小猫爬山题意思路代码 数独题意思路代码 木棒题意思路代码 生日蛋糕题意思路代码 剪枝是什么意思呢? 我们知道,不管是内部搜索还是外部搜索,都可以形成一棵搜索树,如果将搜索树全部遍历一遍,效率…...

dfs之卒的遍历
题面 题目描述 在一张nm 的棋盘上(如 6 行 7 列)的最左上角(1,1) 的位置有一个卒。该卒只能向下或者向右走,且卒采取的策略是先向下,下边走到头就向右,请问从(1,1) 点走到 (n,m) 点可以怎样走,输出这些走法…...
Springboot整合activiti5,达梦数据库,mybatis中间件
Springboot整合activiti5,达梦数据库,mybatis中间件 问题现象解决方案 问题现象 由于工作流引擎不支持达梦数据库以及国产中间件,所以我们引入的时候会报错,这个时候就需要去改造代码和配置文件。各种文档和资料查找一天…...

使用Python + Flask搭建web服务
示例脚本 from flask import Flask# 获取一个实例对象 app Flask(__name__)# 1、注册 app.route(/reg, methods[get]) def reg():return {code: 200,msg: reg ok!}# 2、登录 app.route(/login, methods[get]) def login():return login ok!if __name__ __main__:…...
Winform 打开文件夹、文件、拖拽上传
参考原文:https://blog.csdn.net/u012543266/article/details/21834073 1、打开文件 private void button1_Click(object sender, EventArgs e){OpenFileDialog dialog new OpenFileDialog();dialog.Multiselect true;//该值确定是否可以选择多个文件dialog.Titl…...
热评国内AI四小龙:此一时彼一时,彼此彼此
引言:阿里“清仓”全部持股 商汤科技表示“没啥事” 【科技明说 | 热点关注】 作为国内AI领域的知名科技上市公司,商汤科技SenseTime的一举一动都牵动着业内人士的心。 然而,商汤科技的财报表现没有出奇制胜,却让不…...
[国产MCU]-BL602开发实例-GPIO控制
GPIO与控制 文章目录 GPIO与控制1、GPIO介绍2、GPIO管理相关API介绍3、硬件准备4、软件准备5、代码实现3.1 GPIO输出3.2 GPIO输入3.3 GPIO中断BL602的GLB(Global Register)是芯片通用全局设定模块,主要包含了时钟管理、复位管理、总线管理、内存管理以及GPIO管理等功能。 本文…...
Firefox 配置 Burp_proxy 和 证书
安装代理拓展 安装拓展: chrome : switchomega firefox : foxyproxy 创建代理 : 127.0.0.1:8080 安装burp证书 先开启burp,然后切换到 burp 的代理访问 https://burp/ 下载证书打开firefox设置 - 搜索”证书“ -…...
Leetcode 3576. Transform Array to All Equal Elements
Leetcode 3576. Transform Array to All Equal Elements 1. 解题思路2. 代码实现 题目链接:3576. Transform Array to All Equal Elements 1. 解题思路 这一题思路上就是分别考察一下是否能将其转化为全1或者全-1数组即可。 至于每一种情况是否可以达到…...
在鸿蒙HarmonyOS 5中实现抖音风格的点赞功能
下面我将详细介绍如何使用HarmonyOS SDK在HarmonyOS 5中实现类似抖音的点赞功能,包括动画效果、数据同步和交互优化。 1. 基础点赞功能实现 1.1 创建数据模型 // VideoModel.ets export class VideoModel {id: string "";title: string ""…...

UE5 学习系列(三)创建和移动物体
这篇博客是该系列的第三篇,是在之前两篇博客的基础上展开,主要介绍如何在操作界面中创建和拖动物体,这篇博客跟随的视频链接如下: B 站视频:s03-创建和移动物体 如果你不打算开之前的博客并且对UE5 比较熟的话按照以…...
django filter 统计数量 按属性去重
在Django中,如果你想要根据某个属性对查询集进行去重并统计数量,你可以使用values()方法配合annotate()方法来实现。这里有两种常见的方法来完成这个需求: 方法1:使用annotate()和Count 假设你有一个模型Item,并且你想…...

《通信之道——从微积分到 5G》读书总结
第1章 绪 论 1.1 这是一本什么样的书 通信技术,说到底就是数学。 那些最基础、最本质的部分。 1.2 什么是通信 通信 发送方 接收方 承载信息的信号 解调出其中承载的信息 信息在发送方那里被加工成信号(调制) 把信息从信号中抽取出来&am…...

论文浅尝 | 基于判别指令微调生成式大语言模型的知识图谱补全方法(ISWC2024)
笔记整理:刘治强,浙江大学硕士生,研究方向为知识图谱表示学习,大语言模型 论文链接:http://arxiv.org/abs/2407.16127 发表会议:ISWC 2024 1. 动机 传统的知识图谱补全(KGC)模型通过…...

Python爬虫(一):爬虫伪装
一、网站防爬机制概述 在当今互联网环境中,具有一定规模或盈利性质的网站几乎都实施了各种防爬措施。这些措施主要分为两大类: 身份验证机制:直接将未经授权的爬虫阻挡在外反爬技术体系:通过各种技术手段增加爬虫获取数据的难度…...
Caliper 配置文件解析:config.yaml
Caliper 是一个区块链性能基准测试工具,用于评估不同区块链平台的性能。下面我将详细解释你提供的 fisco-bcos.json 文件结构,并说明它与 config.yaml 文件的关系。 fisco-bcos.json 文件解析 这个文件是针对 FISCO-BCOS 区块链网络的 Caliper 配置文件,主要包含以下几个部…...

基于SpringBoot在线拍卖系统的设计和实现
摘 要 随着社会的发展,社会的各行各业都在利用信息化时代的优势。计算机的优势和普及使得各种信息系统的开发成为必需。 在线拍卖系统,主要的模块包括管理员;首页、个人中心、用户管理、商品类型管理、拍卖商品管理、历史竞拍管理、竞拍订单…...

uniapp 开发ios, xcode 提交app store connect 和 testflight内测
uniapp 中配置 配置manifest 文档:manifest.json 应用配置 | uni-app官网 hbuilderx中本地打包 下载IOS最新SDK 开发环境 | uni小程序SDK hbulderx 版本号:4.66 对应的sdk版本 4.66 两者必须一致 本地打包的资源导入到SDK 导入资源 | uni小程序SDK …...