?? toolkit.java
字號:
package lyb;import java.util.*;import sun.io.*;public class Toolkit { private Toolkit() { } // 代碼集轉換:iso-1 -> gb2312 public static String strISO1ToGB2312(String s) { if( s == null || s.length() == 0) return s; String gb = null; try{ byte [] b = s.getBytes("8859_1"); gb = new String(b, "GB2312"); }catch(java.io.UnsupportedEncodingException e){ gb = e.toString(); } return gb; } // 代碼集轉換:iso-1 -> gb2312 public static String strGB2312ToISO1(String s) { if( s == null || s.length() == 0 ) return s; String iso = null; try{ byte [] b = s.getBytes("GB2312"); iso = new String(b, "8859_1"); }catch(java.io.UnsupportedEncodingException e){ iso = e.toString(); } return iso; } /** *將Ascii轉換成中文字符串 */ public static String AsciiToChineseString(String s) { if(s==null) return ""; //if(true) return s; char[] orig = s.toCharArray(); byte[] dest = new byte[orig.length]; for (int i = 0; i < orig.length; i++) dest[i] = (byte) (orig[i] & 0xFF); try { ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312"); return new String(toChar.convertAll(dest)); } catch (Exception e) { System.out.println(e); return s; } } /** *將中文字符串轉換成Ascii */ public static String ChineseStringToAscii(String s) { if(s==null) return ""; //if(true) return s; try { CharToByteConverter toByte = CharToByteConverter.getConverter("gb2312"); byte[] orig = toByte.convertAll(s.toCharArray()); char[] dest = new char[orig.length]; for (int i = 0; i < orig.length; i++) dest[i] = (char) (orig[i] & 0xFF); return new String(dest); } catch (Exception e) { System.out.println(e); return s; } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -