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

📄 str.java

📁 这是一个在线办公自动化系统
💻 JAVA
字号:

package oa.sys;
/**
 ****************************************************
 *类名称:	Str<br>
 *类功能:	字符串转换操作<br>
 ****************************************************
 */
public class Str {
	/**
	 * 
	 */
	public Str() {
		super();
	}

	/***************************************************
	*函数名称:chStr()<br>
	*函数功能:返回中文字符串<br>
	*返回值:  String<br>
	*参数说明:str<br>
	****************************************************/
	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>
	****************************************************/
	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>
	****************************************************/
	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 + -