Java Hash String hasHtmlTag(String content)

Here you can find the source of hasHtmlTag(String content)

Description

has Html Tag

License

Open Source License

Declaration

public static boolean hasHtmlTag(String content) 

Method Source Code

//package com.java2s;
/*/*w  w w.  ja va  2  s  .c  o  m*/
 This file belongs to the Servoy development and deployment environment, Copyright (C) 1997-2010 Servoy BV
    
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU Affero General Public License as published by the Free
 Software Foundation; either version 3 of the License, or (at your option) any
 later version.
    
 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
    
 You should have received a copy of the GNU Affero General Public License along
 with this program; if not, see http://www.gnu.org/licenses or write to the Free
 Software Foundation,Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
 */

public class Main {
    /** tags in HTML 4.0.1 (some of them are deprecated) */
    @SuppressWarnings("nls")
    public static final String[] tags = { "<!--", "<!DOCTYPE", "<a", "<abbr", "<acronym", "<address", "<applet",
            "<area", "<b", "<base", "<basefont", "<bdo", "<big", "<blockquote", "<body", "<br", "<button",
            "<caption", "<center", "<cite", "<code", "<col", "<colgroup", "<dd", "<del", "<dir", "<div", "<dfn",
            "<dl", "<dt", "<em", "<fieldset", "<font", "<form", "<frame", "<frameset", "<h1", "<h2", "<h3", "<h4",
            "<h5", "<h6", "<head", "<hr", "<html", "<i", "<iframe", "<img", "<input", "<ins", "<isindex", "<kbd",
            "<label", "<legend", "<li", "<link", "<map", "<menu", "<meta", "<noframes", "<noscript", "<object",
            "<ol", "<optgroup", "<option", "<p", "<param", "<pre", "<q", "<s", "<samp", "<script", "<select",
            "<small", "<span", "<strike", "<strong", "<style", "<sub", "<sup", "<table", "<tbody", "<td",
            "<textarea", "<tfoot", "<th", "<thead", "<title", "<tr", "<tt", "<u", "<ul", "<var", "<xmp" };

    public static boolean hasHtmlTag(String content) {
        if (content != null) {
            if (!content.contains("<")) //$NON-NLS-1$
                return false;
            for (String tag : tags) {
                if (content.contains(tag))
                    return true;
            }
        }
        return false;
    }
}

Related

  1. hashString(String s)
  2. hashString(String s)
  3. hashString(String str)
  4. hashString(String str)
  5. hashTermToString(int i, int h)
  6. hasHTMLTag(String html)
  7. hasHTMLTag(String text)
  8. hashToHexString(byte[] hash)
  9. hashToString(byte hash[])