Here you can find the source of toHtmlText(String s)
Parameter | Description |
---|---|
s | Description of the Parameter |
public static String toHtmlText(String s)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w. ja va 2 s . c o m * Description of the Method * * @param s Description of the Parameter * @return Description of the Return Value */ public static String toHtmlText(String s) { s = replace(s, "<br>\r\n", "<br>"); s = replace(s, "\r\n", "<br>"); return s; } /** * Description of the Method * * @param str Description of Parameter * @param o Description of Parameter * @param n Description of Parameter * @return Description of the Returned Value */ public static String replace(String str, String o, String n) { boolean all = true; if (str != null && o != null && o.length() > 0 && n != null) { StringBuffer result = null; int oldpos = 0; do { int pos = str.indexOf(o, oldpos); if (pos < 0) { break; } if (result == null) { result = new StringBuffer(); } result.append(str.substring(oldpos, pos)); result.append(n); pos += o.length(); oldpos = pos; } while (all); if (oldpos == 0) { return str; } else { result.append(str.substring(oldpos)); return result.toString(); } } else { return str; } } /** * Description of the Method * * @param s Description of Parameter * @return Description of the Returned Value */ public static String toString(String s) { if (s != null) { return (s); } else { return (""); } } }