zoukankan      html  css  js  c++  java
  • 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

    //转载哪忘了,别人网上找到发给我的,抱歉!若作者发现麻烦评论区留一下地址,谢谢。

  • 相关阅读:
    活动安排
    中国剩余定理
    欧拉回路
    单词游戏
    Ant Trip
    John's Trip
    太鼓达人
    相框
    原始生物
    Blockade
  • 原文地址:https://www.cnblogs.com/lucong-white/p/8917114.html
Copyright © 2011-2022 走看看