Java Object NVL nvl(String string)

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

Description

If the parameter is null, it will return no-string value(eg.

License

Open Source License

Parameter

Parameter Description
string String The source string

Return

String

Declaration

public static String nvl(String string) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from w w w  .  j  av a2  s.c o  m
     * If the parameter is null, it will return replaceWhenNull string
     * 
     * @param string String The source string
     * @param replacementWhenNull String A string used for replacing null
     * @return String
     */
    public static String nvl(String string, String replacementWhenNull) {

        if (string == null) {
            return replacementWhenNull;
        }

        return string;

    }

    /**
     * If the parameter is null, it will return no-string value(eg. "")
     * 
     * @param string String The source string
     * @return String
     */
    public static String nvl(String string) {

        return nvl(string, "");

    }
}

Related

  1. NVL(String source, String def)
  2. nvl(String source, String defaultString)
  3. nvl(String str)
  4. nvl(String str, String nullString)
  5. NVL(String str, String replace)
  6. nvl(String value)
  7. nvl(String value, String defaultValue)
  8. NVL(String value, String replace)
  9. nvl(String x, String y)