stringutil.java
来自「用strutshibernate做的项目」· Java 代码 · 共 52 行
JAVA
52 行
package com.dut.logic.util;
public class StringUtil {
static public String utf_zhuan(String tr2) {
String result = null;
byte temp[];
try {
temp = tr2.getBytes("ms932");
result = new String(temp, "iso-8859-1");
} catch (Exception e) {
System.out.println(e);
}
return result;
}
/**
* 该方法用于页面到页面的字符转换
* @param tr1
* @return
*/
static public String trans(String tr1) {
String result = null;
byte temp[];
try {
temp = tr1.getBytes("iso-8859-1");
result = new String(temp, "UTF-8");
} catch (Exception e) {
System.out.println(e);
}
return result;
}
/**
* 该方法用于数据库到页面的字符转换
* @param tr1
* @return
*/
static public String trans_date(String tr2) {
String result = null;
byte temp[];
try {
temp = tr2.getBytes("iso-8859-1");
result = new String(temp, "ms932");
} catch (Exception e) {
System.out.println(e);
}
return result;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?