?? str.java
字號:
/*
* Created on 2004-9-18
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package oa.sys;
/**
****************************************************
*類名稱: Str<br>
*類功能: 字符串轉換操作<br>
*創建: 白偉明 2004年9月23日<br>
****************************************************
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class Str {
/**
*
public Str() {
super();
}
/***************************************************
*函數名稱:chStr()<br>
*函數功能:返回中文字符串<br>
*返回值: String<br>
*參數說明:str<br>
*最后修改:白偉明
* 2004年8月17日
****************************************************/
public String chStr(String str){
if(str==null){
str="";
}else{
try{
str=(new String(str.getBytes("iso-8859-1"),"GB2312")).trim();
}catch(Exception e){
System.out.println("chStr");
System.out.println(e.getMessage());
}
}
return str;
}
public String unicodeStr(String str){
if(str==null){
str="";
}else{
try{
str=(new String(str.getBytes("GB2312"),"iso-8859-1")).trim();
}catch(Exception e){
System.out.println("chStr");
System.out.println(e.getMessage());
}
}
return str;
}
/***************************************************
*函數名稱:inStr()<br>
*函數功能:做編碼一次轉換,入庫時防止sql攻擊<br>
*返回值: String<br>
*參數說明:str<br>
*最后修改:白偉明
* 2004年8月17日
****************************************************/
public String inStr(String str){
if(str==null){
str="";
}else{
try{
str=str.replace('\'',(char)1).trim();
}catch(Exception e){
System.out.println("inStr");
System.out.println(e.getMessage());
}
}
return str;
}
/***************************************************
*函數名稱:outStr()<br>
*函數功能:做編碼二次轉換,出庫時防止Exception<br>
*返回值: String
* 返回中文字符串<br>
*參數說明:str<br>
*最后修改:白偉明
* 2004年8月17日
****************************************************/
public String outStr(String str){
if(str==null){
str="";
}else{
try{
str=str.replace((char)1,'\'').trim();
}catch(Exception e){
System.out.println("outStr");
System.out.println(e.getMessage());
}
}
return str;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -