zoukankan      html  css  js  c++  java
  • isNotBlank的用法

    isNotEmpty将空格也作为参数,isNotBlank则排除空格参数

    Quote
    StringUtils方法的操作对象是java.lang.String类型的对象,是JDK提供的String类型操作方法的补充,并且是null安全的(即如果输入参数String为null则不会抛出NullPointerException,而是做了相应处理,例如,如果输入为null则返回也是null等,具体可以查看源代码)。

    除了构造器,StringUtils中一共有130多个方法,并且都是static的,所以我们可以这样调用StringUtils.xxx()

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

    public static boolean isNotEmpty(String str)
    判断某字符串是否非空,等于!isEmpty(String str)

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

    public static boolean isNotBlank(String str)
    判断某字符串是否不为空且长度不为0且不由空白符(whitespace)构成,等于!isBlank(String str)

    import com.baomidou.mybatisplus.core.toolkit.StringUtils;


    if (StringUtils.isNotBlank(sysOrgCdc.getLc())) {

  • 相关阅读:
    使用 GitHub, Jekyll 打造自己的免费独立博客
    如何解决数据科学计数法在数据库中的显示
    RDF
    C# 在 4.0 以后一共有3种创建线程的方式
    C#多线程
    1、框架概述
    3、IDEA 中使用 Maven
    2、Maven 核心概念
    1、Maven 概述
    JDK动态代理
  • 原文地址:https://www.cnblogs.com/csjoz/p/15324759.html
Copyright © 2011-2022 走看看