Java URL Decode decode(String value)

Here you can find the source of decode(String value)

Description

decode

License

Open Source License

Parameter

Parameter Description
value a parameter

Declaration

public static String decode(String value) 

Method Source Code

//package com.java2s;

import java.util.Collection;
import java.util.Map;

public class Main {

    public static String decode(String value) {
        if (isEmpty(value)) {
            return "";
        }/*from   w  w w .j a  v  a 2 s  .c o  m*/
        try {
            return java.net.URLDecoder.decode(value, "utf-8");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return value;
    }

    public static boolean isEmpty(String input) {
        return (input == null || input.length() == 0);
    }

    @SuppressWarnings("rawtypes")
    public static boolean isEmpty(Object pObj) {
        if (pObj == null)
            return true;
        if (pObj == "")
            return true;
        if (pObj instanceof String) {
            if (((String) pObj).length() == 0) {
                return true;
            }
        } else if (pObj instanceof Collection) {
            if (((Collection) pObj).size() == 0) {
                return true;
            }
        } else if (pObj instanceof Map) {
            if (((Map) pObj).size() == 0) {
                return true;
            }
        }
        return false;
    }

    public static String isEmpty(String input, String errorMsg) {
        if (isEmpty(input)) {
            return errorMsg;
        }
        return "";
    }
}

Related

  1. decode(String str)
  2. decode(String str)
  3. decode(String value)
  4. decode(String value)
  5. decode(String value)
  6. decode(String value, String charset)
  7. decode(String value, String charset)
  8. decode(String value, String encoding)
  9. decodeAjax(String value)