?? chstr.java
字號:
package com.core;
public class ChStr {
public static String toChinese(String strvalue) {
try {
if (strvalue == null) { //當(dāng)變量strvalue為null時
strvalue=""; //將變量strvalue賦值為空
} else {
strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK"); //將字符串轉(zhuǎn)換為GBK編碼
strvalue = strvalue.trim(); //去除字符串的首尾空格
}
} catch (Exception e) {
strvalue=""; //將變量strvalue賦值為空
}
return strvalue; //返回轉(zhuǎn)換后的輸入變量strvalue
}
// 處理字符串中的空值
public static final String nullToString(String v, String toV) {
if (v == null || "".equals(v)) { //當(dāng)輸入變量v為空時
v = toV; //將輸入變量v賦值為輸入變量toV
}
return v; //返回轉(zhuǎn)換后的輸入變量v
}
//過濾危險字符
public static final String filterStr(String str){
str=str.replaceAll(";","");
str=str.replaceAll("&","&");
str=str.replaceAll("<","<");
str=str.replaceAll(">",">");
str=str.replaceAll("'","");
str=str.replaceAll("--"," ");
str=str.replaceAll("/","");
str=str.replaceAll("%","");
return str;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -