Java String Decode decode(String s, String charset1, String charset2)

Here you can find the source of decode(String s, String charset1, String charset2)

Description

decode

License

Open Source License

Parameter

Parameter Description
s a parameter
charset1 a parameter
charset2 a parameter

Return

String

Declaration

public static String decode(String s, String charset1, String charset2) 

Method Source Code

//package com.java2s;
/*/*w w  w. ja  va  2  s . c o m*/
 * $RCSfile: StringUtil,v $$
 * $Revision: 1.0  $
 * $Date: 2011  $
 *
 * Copyright (C) 2011 GyTech, Inc. All rights reserved.
 *
 * This software is the proprietary information of GyTech, Inc.
 * Use is subject to license terms.
 */

import java.io.UnsupportedEncodingException;

public class Main {
    public static final String Empty = "";

    /**
    * @param s
    * @param charset1
    * @param charset2
    * @return String
    * @author lizj
    */
    public static String decode(String s, String charset1, String charset2) {
        if (s != null) {
            try {
                return new String(s.getBytes(charset1), charset2);
            } catch (UnsupportedEncodingException e) {
            }
        }

        return Empty;
    }
}

Related

  1. decode(String s)
  2. decode(String s)
  3. decode(String s)
  4. decode(String s)
  5. decode(String s, Class clazz)
  6. decode(String s, String enc, boolean plusToSpace)
  7. decode(String s, String encoding)
  8. decode(String str)
  9. decode(String str)