Here you can find the source of filterHTML(String input)
public static String filterHTML(String input)
//package com.java2s; //License from project: Open Source License public class Main { public static String filterHTML(String input) { StringBuffer filtered = new StringBuffer(input.length()); char c;// w w w. j a va 2s .c o m for (int i = 0; i < input.length(); i++) { c = input.charAt(i); if (c == '<') { filtered.append("<"); } else if (c == '>') { filtered.append(">"); } else if (c == '=') { filtered.append("="); } else if (c == '&') { filtered.append("&"); } else { filtered.append(c); } } return filterForSQL(filtered.toString()); } public static String filterForSQL(String input) { StringBuffer filtered = new StringBuffer(input.length()); char c; for (int i = 0; i < input.length(); i++) { c = input.charAt(i); if (c == '\'') { filtered.append("\'\'"); } else if (c == '\\') { filtered.append("\\\\"); } else { filtered.append(c); } } return filtered.toString(); } }