Java Object NVL nvl(String pValue)

Here you can find the source of nvl(String pValue)

Description

(OVERLOADED) SQL like Null value replace utility converts to ""

License

Open Source License

Declaration

public static String nvl(String pValue) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static <T> T nvl(T pValue, T pReplaceNullsWith) {
        if (pValue != null) {
            return pValue;
        }/*from  w w  w. ja  v  a  2s . c om*/
        return pReplaceNullsWith;
    }

    /** (OVERLOADED) SQL like Null value replace utility */
    public static String nvl(String pValue, String pReplaceNullsWith) {
        if (pValue != null && pValue.length() != 0) {
            return pValue;
        }
        return pReplaceNullsWith;
    }

    /** (OVERLOADED) SQL like Null value replace utility */
    public static final int nvl(String pValue, int pReplaceNullsWith) {
        if (pValue != null && pValue.length() != 0) {
            return Integer.valueOf(pValue).intValue();
        }
        return pReplaceNullsWith;
    }

    /** (OVERLOADED) SQL like Null value replace utility converts to "" */
    public static String nvl(String pValue) {
        return nvl(pValue, "");
    }
}

Related

  1. nvl(Object value, String valueWhenNull)
  2. nvl(S obj, U nullObject)
  3. nvl(String instr, String defaultValue)
  4. nvl(String instr, String defaultValue)
  5. nvl(String pArg1, String pArg2)
  6. nvl(String s)
  7. nvl(String s, String def)
  8. NVL(String s, String valorPorDefecto)
  9. NVL(String source, String def)