1.可对HQL语句查询时候加的%处理,去除%后的字符串.
2.可针对fck或者备注content的换行处理
/**
*
* @param arg0 获取页面人工输入的查询条件
* @return 去除%后的字符串
*/
public static String removedPercent(String arg0) {
String result = "";
if (arg0 != null && arg0.length() > 0) {
for (int i = 0; i < arg0.length(); i++) {
char ch = arg0.charAt(i);
if (ch != '%')
result += ch;
}
}
if(result.trim().length()==0)
return "!{}$@#$%^&*()!";
return result.trim();
}
2.可针对fck或者备注content的换行处理
//字符转换换行和空格
public static String replaceBR(String args){
if(args!=null&&args.trim().length()>0){
return args.replaceAll("\r\n", "<br>").replaceAll(" ", " ");
}
return "";
}