Java Object NVL nvl(String str, String nullString)

Here you can find the source of nvl(String str, String nullString)

Description

nvl

License

Open Source License

Declaration

public static String nvl(String str, String nullString) 

Method Source Code

//package com.java2s;
/**//from w  w  w.java 2s .  c  o m
 *  ETRI Distributed Resource/Mediation System for new re-generation Energy Exchange
 *
 *  Copyright ? [2016] ETRI. All rights reserved.
 *
 *    This is a proprietary software of ETRI, and you may not use this file except in
 *  compliance with license agreement with ETRI. Any redistribution or use of this
 *  software, with or without modification shall be strictly prohibited without prior written
 *  approval of ETRI, and the copyright notice above does not evidence any actual or
 *  intended publication of such software.
 *
 * com.nc.common.utils : StringUtil.java
 * @author creme55
 * @since 2016. 10. 12.
 * @version 1.0
 * @see 
 * @Copyright ? [2016] By ETRI. All rights reserved.
 *
 * <pre>
 * << ??????(Modification Information) >>
 *      ?????              ????                  ????
 *  -------------        -----------       -------------------------
 *  2016. 10. 12.          creme55         ?? ???(???? ?? ????)              
 *
 * </pre>
 **/

public class Main {

    public static String nvl(String str) {
        return (str == null || "null".equals(str)) ? "" : str;
    }

    public static String nvl(Object object) {
        String string = "";
        if (object != null)
            string = object.toString().trim();
        return string;
    }

    public static String nvl(Object object, String str) {
        String string = "";
        try {
            if (object != null) {
                if (!object.toString().equals("")) {
                    string = object.toString().trim();
                } else {
                    string = str;
                }
            } else {
                string = str;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return string;
    }

    public static String nvl(String str, String nullString) {
        return (str == null || "null".equals(str)) ? nullString : str;
    }

    public static boolean equals(String str1, String str2) {
        return (str1 == null ? str2 == null : str1.equals(str2));
    }

    public static String trim(String str) {
        return (str == null ? null : str.trim());
    }

    public static String toString(int value) {
        return Integer.toString(value);
    }
}

Related

  1. nvl(String s, String def)
  2. NVL(String s, String valorPorDefecto)
  3. NVL(String source, String def)
  4. nvl(String source, String defaultString)
  5. nvl(String str)
  6. NVL(String str, String replace)
  7. nvl(String string)
  8. nvl(String value)
  9. nvl(String value, String defaultValue)