Here you can find the source of toHtml(String str)
public static String toHtml(String str)
//package com.java2s; public class Main { public static String toHtml(String str) { if (str == null) return ""; str = str.replaceAll("&", "&"); str = str.replaceAll("<", "<"); str = str.replaceAll(">", ">"); str = str.replaceAll("\"", """); str = str.replaceAll("\r\n", "\n"); str = str.replaceAll("\n", "<br/>"); str = str.replaceAll("\t", " "); str = str.replaceAll(" ", " "); return str; }/*from w w w .j a v a2 s .com*/ }