public class HTMLTruncater extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
CLOSING_TAG_PATTERN
Checks for closing tags, allowing leading and ending space inside the brackets
|
static java.util.regex.Pattern |
EMPTY_TAG_PATTERN
Checks for an empty tag, for example img, br, etc.
|
static java.util.regex.Pattern |
ENTITY_PATTERN
Find > ...
|
static java.util.regex.Pattern |
OPENING_TAG_PATTERN
Checks for opening tags, allowing leading and ending space inside the brackets
|
static java.util.regex.Pattern |
TAG_PATTERN
This pattern creates tokens, where each line starts with the tag.
|
Constructor and Description |
---|
HTMLTruncater() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args) |
static java.lang.String |
truncateHTML(java.lang.String text,
int length) |
static java.lang.String |
truncateHTML(java.lang.String text,
int length,
java.lang.String suffix) |
public static final java.util.regex.Pattern TAG_PATTERN
public static final java.util.regex.Pattern EMPTY_TAG_PATTERN
public static final java.util.regex.Pattern CLOSING_TAG_PATTERN
public static final java.util.regex.Pattern OPENING_TAG_PATTERN
public static final java.util.regex.Pattern ENTITY_PATTERN
public HTMLTruncater()
public static java.lang.String truncateHTML(java.lang.String text, int length, java.lang.String suffix)
public static java.lang.String truncateHTML(java.lang.String text, int length)
public static void main(java.lang.String[] args)