Android String Null Convert toStringWhenNull(Object src, String newValue)

Here you can find the source of toStringWhenNull(Object src, String newValue)

Description

to String When Null

Declaration

public static String toStringWhenNull(Object src, String newValue) 

Method Source Code

//package com.java2s;

public class Main {
    public static String toStringWhenNull(Object src, String newValue) {
        if (src == null) {
            return newValue;
        }// w  w  w . j  a va2  s  .  c  o  m
        String srcStr = src.toString();
        if (srcStr == null) {
            return newValue;
        }
        return srcStr;
    }
}

Related

  1. defaultIfNull(String str)
  2. defaultIfNull(String str, String defaultStr)
  3. defaultIfBlank(String str, String defaultStr)
  4. defaultIfBlank(String str)
  5. isEmptyOrWhitespaceOnly(String str)
  6. toStringWhenNullOrEmpty(Object src, String newValue)
  7. toStringWhenNullOrEmptyOrSpace(Object src, String newValue)