Android String Empty Check nullToEmpty(String url)

Here you can find the source of nullToEmpty(String url)

Description

Use to normalize URL parameters by returning empty string instead of null or "null".

Parameter

Parameter Description
url URL parameter to normalize

Return

Normalized parameter

Declaration

public static String nullToEmpty(String url) 

Method Source Code

//package com.java2s;

public class Main {
    public static final String EMPTY = "";
    public static final String NULL = "null";

    /**//from   www .  j  a v a 2 s . c  o  m
     * Use to normalize URL parameters by returning
     * empty string instead of null or "null".
     * @param url URL parameter to normalize
     * @return Normalized parameter
     */
    public static String nullToEmpty(String url) {
        if (null == url || url.equals(NULL))
            return EMPTY;
        return url;
    }
}

Related

  1. isEmptyString(String s)
  2. isEmptyOrNull(String str)
  3. toNullIfEmptyOrWhitespace(String string)
  4. toNullIfEmpty(String string)
  5. isNullOrEmptyOrOnlyWhitespaces(String string)
  6. isEmpty(String s)
  7. isEmpty(String s)
  8. isEmpty(String str)
  9. trimToEmpty(String str)