Here you can find the source of textToHtml(String text)
public static String textToHtml(String text)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004, 2007 Boeing./*from ww w . j av a2 s. co m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Boeing - initial API and implementation *******************************************************************************/ public class Main { public static String textToHtml(String text) { if (text == null) { return ""; } text = text.replaceAll("&", "&"); text = text.replaceAll(">", ">"); text = text.replaceAll("<", "<"); text = text.replaceAll("\"", """); text = text.replaceAll("\\n", "<br/>"); text = text.replaceAll("[\\x0B\\f\\r]+", ""); return text; } }