public class HTMLTruncater extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
CLOSING_TAG_PATTERN
Checks for closing tags, allowing leading and ending space inside the brackets
|
static Pattern |
EMPTY_TAG_PATTERN
Checks for an empty tag, for example img, br, etc.
|
static Pattern |
ENTITY_PATTERN
Find > ...
|
static Pattern |
OPENING_TAG_PATTERN
Checks for opening tags, allowing leading and ending space inside the brackets
|
static 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(String[] args) |
static String |
truncateHTML(String text,
int length) |
static String |
truncateHTML(String text,
int length,
String suffix) |
public static final Pattern TAG_PATTERN
public static final Pattern EMPTY_TAG_PATTERN
public static final Pattern CLOSING_TAG_PATTERN
public static final Pattern OPENING_TAG_PATTERN
public static final Pattern ENTITY_PATTERN
public HTMLTruncater()
public static String truncateHTML(String text, int length, String suffix)
public static String truncateHTML(String text, int length)