Java HTML Escape HTMLEscapeBr(String original)

Here you can find the source of HTMLEscapeBr(String original)

Description

HTML Escape Br

License

Open Source License

Declaration

public static String HTMLEscapeBr(String original) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String HTMLEscapeBr(String original) {
        if (original == null)
            return "";
        StringBuffer out = new StringBuffer("");
        char[] chars = original.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            boolean found = true;
            switch (chars[i]) {
            case '\n':
                out.append("<br/>");
                break; //newline 
            case '\r':
                break;
            default:
                found = false;/*w  ww.j av  a  2s . c om*/
                break;
            }
            if (!found)
                out.append(chars[i]);

        }
        return out.toString();
    }
}

Related

  1. htmlEscape(String string)
  2. htmlEscape(String tag)
  3. htmlEscape(String text)
  4. htmlescapeAll(String s1)
  5. htmlEscapeBasicMarkup(final String text)
  6. htmlEscapeSpace(String uri)
  7. htmlUnescape(String safeHtml)