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的更多相关文章

  1. JAVAWEB项目实现验证码中文、英文、数字组合

    验证码基础 一.什么是验证码及它的作用 :验证码为全自动区分计算机和人类的图灵测试的缩写,是一种区分用户是计算机的公共全自动程序,这个问题可以由计算机生成并评判,但是必须只有人类才能解答.可以防止恶意 ...

  2. 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/ ...

  3. 数据你把它的金额-JAVA分页

    数据量你造吗-JAVA分页 原创地址:   http://www.cnblogs.com/Alandre/  (泥沙砖瓦浆木匠),须要转载的,保留下! Thanks 学习的心态第一,解行要对应. 事实 ...

  4. springboot中使用kindeditor富文本编辑器实现博客功能

    kindeditor在之前已经用过,现在在springboot项目中使用.并且也在里面使用了图片上传以及回显等功能. 其实主要的功能是图片的处理:kindeditor对输入的内容会作为html标签处理 ...

  5. springboot上传文件 & 不配置虚拟路径访问服务器图片 & springboot配置日期的格式化方式 & Springboot配置日期转换器

    1.    Springboot上传文件 springboot的文件上传不用配置拦截器,其上传方法与SpringMVC一样 @RequestMapping("/uploadPicture&q ...

  6. 【转载】MessageFormat.format方法

    MessageFormat.format方法实例 public static void main(String[] args) { String a= "aaa"; String ...

  7. 数据量你造吗-JAVA分页

    原创地址:   http://www.cnblogs.com/Alandre/  (泥沙砖瓦浆木匠),需要转载的,保留下! Thanks 学习的心态第一,解行要相应.其实<弟子规>在“余力 ...

  8. Workbook导出excel封装的工具类

    在实际中导出excel非常常见,于是自己封装了一个导出数据到excel的工具类,先附上代码,最后会写出实例和解释.支持03和07两个版本的 excel. HSSF导出的是xls的excel,XSSF导 ...

  9. commons-lang3工具类学习(三)

    六.ObjectUtils Object工具类 allNotNull(Object... values) 检查所有元素是否为空,返回一个boolean 如果有一个元素为空返回false,所有元素不为空 ...

随机推荐

  1. Servlet3.0与springmvc那些事

    官方文档:https://docs.spring.io/spring/docs/5.0.2.RELEASE/spring-framework-reference/web.html#mvc-servle ...

  2. chrome浏览器导出文件提示病毒扫描失败

    转自https://zhidao.baidu.com/question/758059392558639324.html 1.windows+R,打开运行 2.输入regedit.exe,确定,打开注册 ...

  3. python 字典操作提取key,value

    python 字典操作提取key,value dictionaryName[key] = value 1.为字典增加一项  2.访问字典中的值  3.删除字典中的一项  4.遍历字典  5.字典遍历的 ...

  4. deep learning入门:感知机

    权重和偏置 import numpy as np # 求x1 and x2 def AND(x1, x2): x = np.array([x1, x2]) w = np.array([0.5, 0.5 ...

  5. P5245 【模板】多项式快速幂

    思路 调了半天发现ln忘了清空数组了... 就是这个式子 \[ A^k(x) \equiv e^{k{\ln (A(x)) }} \] 代码 #include <cstdio> #incl ...

  6. (转)AutoML for Data Augmentation

    AutoML for Data Augmentation 2019-04-01 09:26:19 This blog is copied from: https://blog.insightdatas ...

  7. EJB 笔记

    EJB(Enterprise JavaBean)是J2EE服务器端的组件模型,EJB包括会话Bean(Session Bean).实体Bean(Entity Bean).消息驱动Bean(Messag ...

  8. CentOS7攻克日记(二) —— 配置初始化及网络配置

    reboot之后到达这个页面,点击第一个进去同意一下协议之后Done,然后点击右下角的FINISH

  9. redis序列化

    private void setSerializer(StringRedisTemplate template) { Jackson2JsonRedisSerializer jackson2JsonR ...

  10. oracle to_char 格式大全

    Postgres 格式化函数提供一套有效的工具用于把各种数据类型(日期/时间,int,float,numeric)转换成格式化的字符串以及反过来从格式化的字符串转换成原始的数据类型. 注意:所有格式化 ...