?? tounicode.java
字號(hào):
/** ToUnicode.java */
package caiwu;
import java.io.*;
/**
* 字符串轉(zhuǎn)換成Unicode碼的類
* @author trowa
* @date 2003-03-05
*/
public class ToUnicode {
/**
* 把字符串轉(zhuǎn)換成Unicode碼
* @param strText 待轉(zhuǎn)換的字符串
* @param code 轉(zhuǎn)換前字符串的編碼,如"GBK"
* @return 轉(zhuǎn)換后的Unicode碼字符串
*/
public String toUnicode(String strText,String code) throws UnsupportedEncodingException{
char c;
String strRet = "" ;
int intAsc;
String strHex;
strText = new String(strText.getBytes("8859_1"),code);
for ( int i = 0; i < strText.length(); i++ ){
c = strText.charAt(i);
intAsc = (int)c;
if(intAsc>128){
strHex = Integer.toHexString(intAsc);
strRet = strRet + "&#x" + strHex+";";
}
else{
strRet = strRet + c;
}
}
return strRet ;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -