Java Object to String castString(Object obj, String defaultValue)

Here you can find the source of castString(Object obj, String defaultValue)

Description

cast String

License

Apache License

Declaration

public static String castString(Object obj, String defaultValue) 

Method Source Code

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

public class Main {

    public static String castString(Object obj, String defaultValue) {
        return obj != null ? String.valueOf(obj) : defaultValue;
    }//w ww. j a  v  a2 s  .c  o  m

    public static String castString(Object obj) {
        return castString(obj, "");
    }
}

Related

  1. castString(Object o)
  2. castString(Object obj)
  3. castString(Object val)
  4. castToString(Object inValue)
  5. castToString(Object object)
  6. castToString(Object value)