⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chinese.java~3~

📁 这是一个用Struts做出来的网上商城的源代码
💻 JAVA~3~
字号:
package com.tool;

import java.io.*;

//中文字符级转换
public class Chinese {


  public static String toUnicode(String strvalue) {
        try {
            if (strvalue == null) {
                return null;
            } else {
                strvalue = new String(strvalue.getBytes("GBK"), "ISO8859_1");
                return strvalue;
            }
        } catch (Exception e) {
            return "";
        }
    }


  public static String toChinese(String strvalue) {
    try {
      if (strvalue == null) {
        return "";
      }
      else {
        strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
        return strvalue;
      }
    }
    catch (Exception e) {
      return "";
    }
  }

  public static String chinese(String a) {
    try {
      return new String(a.getBytes("ISO-8859-1"));
    }
    catch (UnsupportedEncodingException ex) {
      return null;
    }
  }
}

⌨️ 快捷键说明

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