⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 characterset.java

📁 struts hibernate spring
💻 JAVA
字号:
package com.syfxapp.util;
import java.util.*;
import java.io.*;

public class CharacterSet {
	public static String Iso2Gb(String str)
    throws UnsupportedEncodingException
	{
	    String result = null;
	    if(str==null)
	    	return null;
	    if (str.equals(""))
	    	return null;
	    else{byte temp[] = str.getBytes("iso-8859-1");
	    result = new String(temp, "gbk");
	    }
	    return result;
	}
	public static String Gb2Iso(String str)
	    throws UnsupportedEncodingException
	{
	    if(str.equals(""))
	    {
	        return null;
	    } else
	    {
	        String result = null;
	        byte temp[] = str.getBytes("gb2312");
	        result = new String(temp, "iso-8859-1");
	        return result;
	    }
	}
	public static String Utf2Gb(String str)
    throws UnsupportedEncodingException
    {
	    if(str.equals(""))
	    {
	        return null;
	    } else
	    {
	        String result = null;
	        byte temp[] = str.getBytes("utf8");
	        result = new String(temp, "gb2312");
	        return result;
	    }
    }
	public static String Gb2utf(String str)
    throws UnsupportedEncodingException
    {
	    if(str.equals(""))
	    {
	        return null;
	    } else
	    {
	        String result = null;
	        byte temp[] = str.getBytes("gb2312");
	        result = new String(temp, "utf8");
	        return result;
	    }
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -