public static boolean isEmpty(String str)

判断某字符串是否为空,为空的标准是str==null或str.length()==0

StringUtils.isEmpty(null) = true
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false //注意在StringUtils中空格作非空处理
StringUtils.isEmpty(" ") = false
StringUtils.isEmpty("bob") = false
StringUtils.isEmpty(" bob ") = false

public static boolean isBlank(String str)
判断某字符串是否为空或长度为0或由空白符(whitespace)构成

StringUtils.isBlank(null) = true
StringUtils.isBlank("") = true
StringUtils.isBlank(" ") = true
StringUtils.isBlank(" ") = true
StringUtils.isBlank("\t \n \f \r") = true //对于制表符、换行符、换页符和回车符StringUtils.isBlank()均识为空白符
StringUtils.isBlank("\b") = false //"\b"为单词边界符
StringUtils.isBlank("bob") = false
StringUtils.isBlank(" bob ") = false

org.apache.commons.lang.StringUtils中isEmpty和isBlank的区别的更多相关文章

  1. org.apache.commons.lang.StringUtils 中 Join 函数

    转自 http://my.oschina.net/zenglingfan/blog/134872 写代码的时候,经常会碰到需要把一个List中的每个元素,按逗号分隔转成字符串的需求,以前是自己写一段比 ...

  2. org.apache.commons.lang.StringUtils中常用的方法

    org.apache.commons.lang.StringUtils中常用的方法,这里主要列举String中没有,且比较有用的方法: 1. 检查字符串是否为空: static boolean isB ...

  3. java中StringUtils中isEmpty 和isBlank的区别

    StringUtils在commons-lang-2.2.jar包中:org.apache.commons.lang.StringUtils ; StringUtils方法的操作对象是java.lan ...

  4. StringUtils中isEmpty 和isBlank的区别

    StringUtils在commons-lang-2.2.jar包中:org.apache.commons.lang.StringUtils ; StringUtils方法的操作对象是java.lan ...

  5. StringUtils 中 isEmpty 和 isBlank 的区别

    在项目的工作学习中经常用到了 apache  commons 中的 StringUtils 的 isBlank 和 isEmpty 来判断字符串是否为空,这个方法都是判断字符串是否为空做判断的,以至于 ...

  6. StringUtils中 isEmpty 和isBlank的区别

    StringUtils方法的操作对象是java.lang.String类型的对象,是JDK提供的String类型操作方法的补充,并且是null安全的(即如果输入参数String为null则不会抛出Nu ...

  7. org.apache.commons.lang.StringUtils类

    org.apache.commons.lang.StringUtils类 本文摘自:(http://www.blogjava.net/japper/archive/2012/05/23/378946. ...

  8. apache commons lang包中的StringUtils

    计算一个字符串某个字符的出现次数 a, 使用charAt方法截取之后,循环判断. b, 使用apache commons lang包中的StringUtils: int n = StringUtils ...

  9. org.apache.commons.lang.StringUtils

    org.apache.commons.lang.StringUtils 作为jdk中lang包的补充 检查CharSequence是否为空,null或者空格 CharSequence (CharBuf ...

随机推荐

  1. .Net高级技术——结构体

    结构体 结构体和类的区别:结构体是值类型,类是引用类型 结构体非常类似于类,但是值类型(拷贝传递),不能被继承 Int32.DateTime等都是结构体,从ValueType继承,值类型. 结构体测试 ...

  2. mysql查询null异常:attempted to return null from a method with a primitive return type

    select sum(deposit_amount)from tb_commission_ib_day mysql查询时报异常: attempted to return null from a met ...

  3. C# 获得当前 进程 或 线程的ID

    如果获得当前进程的Id用: Process[] processes = Process.GetProcesses(); foreach(Process process in processes) {  ...

  4. linux常用命令集锦

    linux 查看所有用户所在组   vi /etc/group 一个用户可以属于多个组,查看用户所属的组,groups + 用户名 linux 查找文件命令   find -name 文件名    在 ...

  5. 单独配置secondarynamenode

    一.配置说明 这是在我之前yarn框架上通过加入节点,改动相关的配置文件,使得secondarynamenode独立出来的,所以这里前期的一系列琐碎配置请參考我之前的博客: http://blog.c ...

  6. Selenium2+python自动化57-捕获异常(NoSuchElementException)

    前言 在定位元素的时候,经常会遇到各种异常,为什么会发生这些异常,遇到异常又该如何处理呢? 本篇通过学习selenium的exceptions模块,了解异常发生的原因. selenium+python ...

  7. Web Sessions Installation

    展示不使用Terracotta DSO如何集群Web Sessions. 1.要求 1)jdk1.6或者更高版本 2)Terracotta 3.7或者更高版本 3)所有被集群的对象需要实现序列化,如果 ...

  8. hadoop安装入门

    1.jdk安装和配置 1.1下载最新jdk文件 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-18802 ...

  9. OpenCV学习(26) 直方图(3)

    本章中我们学习一下通过backproject直方图,得到一副图像中每个像素属于该直方图的概率.在下边原始图中(左图),我们框选了一块四边形的区域,计算该区域的灰度直方图,然后通过下面的函数calcBa ...

  10. 如何在Windows 7 或Vista中修改MTU

    Windows操作系统使用Maximum Transmission Unit (MTU) 来确定在下面的网络层上可以传输的协议数据包(protocol data packet)的最大尺寸. MTU参数 ...