transformat.java

来自「经典的“企业内部管理信息系统”JSP源代码」· Java 代码 · 共 38 行

JAVA
38
字号
/*
 * Created on 2004-9-21
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package util;
import java.io.*;
/**
 * @author WineFox
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class TransFormat {
public static String unicode2GB(String strIn){
byte b[];
String strOut=null;
if (strIn==null||((strIn.trim()).equals("")))
return strIn;
try {
b=strIn.getBytes("GBK");
strOut=new String(b,"ISO8859_1");
}catch(UnsupportedEncodingException e){
}
return strOut;
}
public static String GB2unicode(String strIn){
String strOut=null;
if (strIn==null||((strIn.trim()).equals(""))) return strIn;
try {
byte b[]=strIn.getBytes("ISO8859_1");
strOut=new String(b,"GBK");}
catch(Exception e){}
return strOut;
}
}

⌨️ 快捷键说明

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