Java HTML Sanitize sanitizeForHtmlTag(String string)

Here you can find the source of sanitizeForHtmlTag(String string)

Description

Escapes HTML tag safely.

License

Open Source License

Declaration

public static String sanitizeForHtmlTag(String string) 

Method Source Code

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

public class Main {
    /**//from w w w .  ja va  2  s.co m
     * Escapes HTML tag safely. This function can be applied multiple times.
     */
    public static String sanitizeForHtmlTag(String string) {
        if (string == null) {
            return null;
        }
        return string.replace("<", "&lt;").replace(">", "&gt;");
    }
}

Related

  1. sanitize(String html)
  2. sanitizeQuot(String html)