com.alee.utils
Class HtmlUtils

java.lang.Object
  extended by com.alee.utils.HtmlUtils

public final class HtmlUtils
extends java.lang.Object

This class provides a set of utilities to work with HTML.

Author:
Mikle Garin

Field Summary
static java.lang.String DEFAULT_LINE_SEPARATOR
           
 
Constructor Summary
HtmlUtils()
           
 
Method Summary
static java.lang.String bold(java.lang.String text)
          Returns HTML with specified text made bold.
static java.lang.String convertToMultilineHtml(java.lang.String text, java.lang.String... lineBreak)
          Returns text converted into multiline HTML.
static java.lang.String getContent(java.lang.String text)
          Returns HTML content between body or html tags.
static java.lang.String getPlainText(java.lang.String html)
          Returns plain text extracted from the specified HTML.
static java.lang.String getPlainText(java.lang.String html, java.lang.String lineSeparator)
          Returns plain text extracted from the specified HTML.
static boolean hasHtml(java.lang.String text)
          Returns whether specified text contains HTML tag or not.
static boolean hasTag(java.lang.String text, java.lang.String tag)
          Returns whether text contains the specified tag or not.
static boolean hasTags(java.lang.String text)
          Returns whether the specified text contains HTML tags or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LINE_SEPARATOR

public static final java.lang.String DEFAULT_LINE_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

HtmlUtils

public HtmlUtils()
Method Detail

getPlainText

public static java.lang.String getPlainText(java.lang.String html)
Returns plain text extracted from the specified HTML.

Parameters:
html - HTML
Returns:
plain text

getPlainText

public static java.lang.String getPlainText(java.lang.String html,
                                            java.lang.String lineSeparator)
Returns plain text extracted from the specified HTML.

Parameters:
html - HTML
lineSeparator - line separator
Returns:
plain text

bold

public static java.lang.String bold(java.lang.String text)
Returns HTML with specified text made bold.

Parameters:
text - text to process
Returns:
HTML with specified text made bold

hasTags

public static boolean hasTags(java.lang.String text)
Returns whether the specified text contains HTML tags or not.

Parameters:
text - text to process
Returns:
true if the specified text contains HTML tags, false otherwise

hasHtml

public static boolean hasHtml(java.lang.String text)
Returns whether specified text contains HTML tag or not.

Parameters:
text - text to process
Returns:
true if specified text contains HTML tag, false otherwise

hasTag

public static boolean hasTag(java.lang.String text,
                             java.lang.String tag)
Returns whether text contains the specified tag or not.

Parameters:
text - text to process
tag - tag to find
Returns:
true if text contains the specified tag, false otherwise

getContent

public static java.lang.String getContent(java.lang.String text)
Returns HTML content between body or html tags.

Parameters:
text - text to process
Returns:
HTML content between body or html tags

convertToMultilineHtml

public static java.lang.String convertToMultilineHtml(java.lang.String text,
                                                      java.lang.String... lineBreak)
Returns text converted into multiline HTML.

Parameters:
text - text to convert
lineBreak - line break text
Returns:
text converted into multiline HTML