Java String Empty to Null isHtmlNull(String str)

Here you can find the source of isHtmlNull(String str)

Description

is Html Null

License

Open Source License

Declaration

public static boolean isHtmlNull(String str) 

Method Source Code

//package com.java2s;
/*/*from   w  w  w .j a v a  2  s  . co m*/
* @(#)Utility.java
*
* Copyright (c) 2003 DCIVision Ltd
* All rights reserved.
*
* This software is the confidential and proprietary information of DCIVision
* Ltd ("Confidential Information").  You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the license
* agreement you entered into with DCIVision Ltd.
 */

public class Main {
    public static boolean isHtmlNull(String str) {
        if (isEmpty(str) || "null".equals(str.toLowerCase().trim())) {
            return true;
        }
        return false;
    }

    /**
     * isEmpty
     *
     * Test to see whether input string is empty.
     *
     * @param   str A String
     * @return  True if it is empty; false if it is not.
     */
    public static boolean isEmpty(String str) {
        return (str == null || str.length() == 0 || str.trim().equals(""));
    }

    /**
     * isEmpty
     *
     * Test to see whether input string buffer is empty.
     *
     * @param   str A StringBuffer
     * @return  True if it is empty; false if it is not.
     */
    public static boolean isEmpty(StringBuffer stringBuffer) {
        return (stringBuffer == null || stringBuffer.length() == 0 || stringBuffer.toString().trim().equals(""));
    }

    /**
     * isEmpty
     *
     * Test to see whether input string is empty.
     *
     * @param   str A String
     * @return  True if it is empty; false if it is not.
     */
    public static boolean isEmpty(Object[] array) {
        return (array == null || array.length == 0);
    }

    /**
     * isEmpty
     *
     * Test to see whether input is empty.
     *
     * @param   StringArray A array
     * @return  True if it is empty; false if it is not.
     */
    public static boolean isEmpty(String[] array) {
        return (array == null || array.length == 0);
    }

    /**
     * isEmpty
     *
     * Test to see whether input is representing a NULL value.
     *
     * @param   val An Object
     * @return  True if it represents NULL; false if it is not.
     */
    public static boolean isEmpty(Object val) {
        return (val == null);
    }

    /**
     * isEmpty
     *
     * Test to see whether input is empty.
     *
     * @param   list A List
     * @return  True if it is empty; false if it is not.
     */
    public static boolean isEmpty(java.util.List list) {
        return (list == null || list.size() == 0);
    }
}

Related

  1. emptyToNull(String string)
  2. emptyToNull(String text)
  3. emptyToNull(String val)
  4. emptyToNull(String value)
  5. emptyToString(String str, String returnStr)
  6. nullSafeToString(Object obj)
  7. nvlStr(Object o, String valueIfNull)
  8. parseCommas(String s, boolean ignoreNulls)
  9. removeNulls(String... strings)