Java Null Value Convert null2default(final String str, final String def)

Here you can find the source of null2default(final String str, final String def)

Description

nulldefault

License

Apache License

Declaration

public static final String null2default(final String str, final String def) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static final String null2default(final String str, final String def) {
        return (str == null || str.length() <= 0) ? def : str;
    }/*from  w ww .  ja  v  a  2  s .c o m*/
}

Related

  1. convertNullValue(final Class convertType)
  2. null2blank(String prnStr)
  3. null2blank(String source)
  4. null2Boolean(Object expression, boolean defValue)
  5. null2Boolean(Object s)
  6. null2dots(Object s)
  7. null2Double(Object s)
  8. null2Double(Object s, double defValue)
  9. null2Empty(Object obj)