chineseutils.java
来自「Java项目开发与毕业设计指导 朱福喜, 黄昊编著 清华大学出版社 项目2」· Java 代码 · 共 46 行
JAVA
46 行
package utils;
/**
* @author lixiaoqing
*
*/
public class ChineseUtils {
/**
* 从数据库读出数据时的编码转换
* @param chi 输入字符串
* @return 转换后的字符串
*/
public static String transToEn(String chi)
{
String result = null;
byte temp[];
try
{
temp = chi.getBytes("iso-8859-1");
result = new String(temp);
}
catch(Exception e)
{
}
return result;
}
public static String transToCh(String chi)
{
String result = null;
byte temp[];
try
{
temp = chi.getBytes("gb2312");
result = new String(temp);
}
catch(Exception e)
{
}
return result;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?