|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.calitha.util.StringUtil
public final class StringUtil
The StringUtil class provides several static convenience methods for manipulating strings or producing string results.
| Nested Class Summary | |
|---|---|
static class |
StringUtil.TextAlignment
|
| Method Summary | |
|---|---|
static void |
fill(StringBuffer buffer,
char filler,
int size,
StringUtil.TextAlignment align)
Fills a buffer to a certain size with a filler character. |
static String |
fill(String str,
char filler,
int size,
StringUtil.TextAlignment align)
Fills a string to a certain size with a filler character. |
static String |
stackTraceToString(StackTraceElement[] stackTrace)
Creates a string representation of a stack trace. |
static String |
stripTags(String text)
Strips all tags from text. |
static String |
stripTags(String text,
List<String> ignoreList)
Strips the tags from text that are not in the ignoreList. |
static String |
trimLeadingChar(String str,
char ch)
Trims leading characters from a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void fill(StringBuffer buffer,
char filler,
int size,
StringUtil.TextAlignment align)
The alignment determines where to add the filler characters to keep the text in the buffer in that position. For example LEFT alignment means that the filler characters will be added to the right.
Possible choices are LEFT, RIGHT or CENTER. Default is LEFT.
The buffer is filled in the left or right side.
buffer - buffer to be filledfiller - character that is used to fill the buffersize - size to which the buffer will growalign - alignment of text in the buffer
IllegalArgumentException - if the buffer argument is null
public static String fill(String str,
char filler,
int size,
StringUtil.TextAlignment align)
The alignment determines where to add the filler characters to keep the text in that position. For example LEFT alignment means that the filler characters will be added to the right. Possible choices are LEFT, RIGHT or CENTER
str - string that will be filledfiller - filler charactersize - size to which the buffer will growalign - alignment of text in the buffer
IllegalArgumentException - if the buffer argument is nullfill(StringBuffer, char, int, TextAlignment)
public static String trimLeadingChar(String str,
char ch)
str - string that is trimmedch - character being trimmed from the string
IllegalArgumentException - if an argument is nullpublic static String stackTraceToString(StackTraceElement[] stackTrace)
stackTrace - stack trace
IllegalArgumentException - if an argument is nullpublic static String stripTags(String text)
text - text input
IllegalArgumentException - if an argument is null
public static String stripTags(String text,
List<String> ignoreList)
text - text inputignoreList - list of tags to be kept in the input
or null if all tags must be removed
IllegalArgumentException - if the text argument is null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||