StringUtils.defaultIfBlank
StringUtils.defaultIfBlank
在字符串为null,空串或者空白串的时候,返回指定的默认值。
org.apache.commons.lang.StringUtils defaultIfBlank方法 写道
public static String defaultIfBlank(String str, String defaultStr)
Returns either the passed in String, or if the String is whitespace, empty ("") or null, the value of defaultStr.
StringUtils.defaultIfBlank(null, "NULL") = "NULL"
StringUtils.defaultIfBlank("", "NULL") = "NULL"
StringUtils.defaultIfBlank(" ", "NULL") = "NULL"
StringUtils.defaultIfBlank("bat", "NULL") = "bat"
StringUtils.defaultIfBlank("", null) = null
Parameters:
str - the String to check, may be null
defaultStr - the default String to return if the input is whitespace, empty ("") or null, may be null
Returns:
the passed in String, or the default
//转载哪忘了,别人网上找到发给我的,抱歉!若作者发现麻烦评论区留一下地址,谢谢。
StringUtils.defaultIfBlank的更多相关文章
- JAVAWEB项目实现验证码中文、英文、数字组合
验证码基础 一.什么是验证码及它的作用 :验证码为全自动区分计算机和人类的图灵测试的缩写,是一种区分用户是计算机的公共全自动程序,这个问题可以由计算机生成并评判,但是必须只有人类才能解答.可以防止恶意 ...
- Creating a CSRF protection with Spring 3.x--reference
reference from:http://info.michael-simons.eu/2012/01/11/creating-a-csrf-protection-with-spring-3-1/ ...
- 数据你把它的金额-JAVA分页
数据量你造吗-JAVA分页 原创地址: http://www.cnblogs.com/Alandre/ (泥沙砖瓦浆木匠),须要转载的,保留下! Thanks 学习的心态第一,解行要对应. 事实 ...
- springboot中使用kindeditor富文本编辑器实现博客功能
kindeditor在之前已经用过,现在在springboot项目中使用.并且也在里面使用了图片上传以及回显等功能. 其实主要的功能是图片的处理:kindeditor对输入的内容会作为html标签处理 ...
- springboot上传文件 & 不配置虚拟路径访问服务器图片 & springboot配置日期的格式化方式 & Springboot配置日期转换器
1. Springboot上传文件 springboot的文件上传不用配置拦截器,其上传方法与SpringMVC一样 @RequestMapping("/uploadPicture&q ...
- 【转载】MessageFormat.format方法
MessageFormat.format方法实例 public static void main(String[] args) { String a= "aaa"; String ...
- 数据量你造吗-JAVA分页
原创地址: http://www.cnblogs.com/Alandre/ (泥沙砖瓦浆木匠),需要转载的,保留下! Thanks 学习的心态第一,解行要相应.其实<弟子规>在“余力 ...
- Workbook导出excel封装的工具类
在实际中导出excel非常常见,于是自己封装了一个导出数据到excel的工具类,先附上代码,最后会写出实例和解释.支持03和07两个版本的 excel. HSSF导出的是xls的excel,XSSF导 ...
- commons-lang3工具类学习(三)
六.ObjectUtils Object工具类 allNotNull(Object... values) 检查所有元素是否为空,返回一个boolean 如果有一个元素为空返回false,所有元素不为空 ...
随机推荐
- Java8-Map
1.Staff实体 public class Staff { private String name; private int age; private String address; public ...
- Parhaps you are running on a JRE rather than a JDK?
maven项目启动时报错 解决方案: 第一步:在启动项目上右击 第二步:修改JRE为JDK,双击划线部分 第三步:如果没有配置JDK,进行以下操作 第四步:从本地添加JDK 第五步:应用JDK 选择好 ...
- mysqldiff差异比较
1.安装mysql-utilities[root@localhost soft]# yum install mysql-utilities.noarch 2.比较数据库zentao和数据库db_ze ...
- MySql 8.0 C#连接报错 MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host '12.118.224.181' for user 'root' using method 'caching_sha2_password' failed with message: Reading from t
解决方法 在连接字符串后面加上 SslMode=None
- Python3 tkinter基础 TK title 设置窗体的标题
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- 论文笔记:Siamese Cascaded Region Proposal Networks for Real-Time Visual Tracking
Siamese Cascaded Region Proposal Networks for Real-Time Visual Tracking 2019-03-20 16:45:23 Paper:ht ...
- 2、Docker基础用法
容器镜像:https://hub.docker.com/ Docker架构图: https://ruby-china.org/topics/22004 Docker使用客户端-服务器(client- ...
- 15_Raid及mdadm命令 _LVM
磁盘管理: 机械式硬盘: U盘,光盘,软盘,硬件,磁带 ln [ -s -v ] SRC DEST 硬链接: 1.只能对文件创建,不能应用于目录 2.不能跨文件系统 ...
- HTML5外包团队:HTML5 Canvas使用教程
canvas 元素用于在网页上绘制图形. 什么是 Canvas? HTML5 的 canvas 元素使用 JavaScript 在网页上绘制图像. 画布是一个矩形区域,您可以控制其每一像素. canv ...
- linux查看用户登录时间以及命令历史
1.查看当前登录用户信息 who命令: who缺省输出包括用户名.终端类型.登陆日期以及远程主机. who /var/log/wtmp 可以查看自从wtmp文件创建以来的每一次登陆情况 (1)-b:查 ...