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())) {

  • 相关阅读:
    Keepalived 无法自动转换主备角色,请关注 iptables 防火墙配置
    Linux 下使用网易的SMTP服务器 发送邮件
    Spring-boot 最小demo
    go build 时报错 cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
    spark-shell 执行脚本并传入参数
    JVM
    spark
    spark
    linux
    linux
  • 原文地址:https://www.cnblogs.com/csjoz/p/15324759.html
Copyright © 2011-2022 走看看