📄 charsetconvert.java
字号:
/*
* Created on 2005-12-21
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package MyBean;
import java.io.*;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class charsetConvert {
final static public String m_GBCharCode = "GB2312";
final static public String m_ISOCharCode = "iso-8859-1";
public charsetConvert() {
}
public static String convertCharCode(String m_string, String CharCodeOld,
String CharCodeNew) {
String result = m_string;
if (result != null && !result.trim().equals("")) {
try {
if ( (!CharCodeOld.trim().equals("")) && (!CharCodeNew.trim().equals(""))) {
byte bytes[] = result.getBytes();
result = new String(bytes, CharCodeNew);
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}
return result;
}
public static String convert(String message) {
return convertCharCode(message, m_GBCharCode, m_ISOCharCode);
}
public static String parseChinese(String in) {
String s = null;
byte[] temp;
if (in == null) {
return "";
}
try {
temp = in.getBytes(m_ISOCharCode);
s = new String(temp);
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return s;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -