Here you can find the source of toHTMLString(String org)
public static String toHTMLString(String org)
//package com.java2s; //License from project: Open Source License public class Main { public static String toHTMLString(String org) { StringBuffer result = new StringBuffer(org.length()); char[] chars = org.toCharArray(); for (int i = 0; i < chars.length; i++) { if (chars[i] == '\"') result.append("""); else if (chars[i] == '<') result.append("<"); else if (chars[i] == '>') result.append(">"); else if (chars[i] == '&') result.append("&"); else// w w w . ja v a2 s . c o m result.append(chars[i]); } return result.toString(); } }