JAVA过滤特殊字符
2015-03-11 13:42
507 查看
public class StringFilter { public static String validaString(String in){ StringBuffer out = new StringBuffer(); // Used to hold the output. char current; // Used to reference the current character. if (in == null || ("".equals(in))) return ""; // vacancy test. for (int i = 0; i < in.length(); i++) { current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught // here; it should not happen. if ((current == 0x9) || (current == 0xA) || ((current >= 0x20) && (current <= 0xD7FF)) || ((current >= 0xE000) && (current <= 0xFFFD)) || ((current >= 0x10000) && (current <= 0x10FFFF))) out.append(current); } return out.toString(); }
相关文章推荐
- java过滤特殊字符
- Java过滤特殊字符的正则表达式----转载
- java正则表达式 过滤特殊字符的正则表达式
- JAVA特殊字符过滤
- java 使用正则来过滤字符串中的特殊字符
- java 过滤特殊字符
- Java过滤特殊字符的正则表达式
- Java 使用正则表达式过滤字符串中的特殊字符
- 用Java过滤掉不能作为xml内容的特殊字符
- java 过滤特殊字符
- java 过滤器(过滤客户端表单特殊字符、服务器端特殊字符、以及编码过滤)
- 正则:Java过滤特殊字符的正则表达式
- Java 过滤特殊字符的 正则表达式
- Java过滤特殊字符的正则表达式
- Java过滤特殊字符的正则表达式----转载
- java 过滤特殊字符
- java正则表达式 过滤特殊字符的正则表达式
- 过滤Java中特殊字符
- Java 过滤Oracle的like条件的特殊字符
- java 过滤文本特殊字符 以及单斜杠替换成双斜杠