|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.taglibs.string.util.StringW
public final class StringW
A set of String library static methods. While extending String or StringBuffer would have been the nicest solution, that is not possible, so a simple set of static methods seems the most workable. Method ideas have so far been taken from the PHP4, Ruby and .NET languages.
| Constructor Summary | |
|---|---|
StringW()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
quoteRegularExpression(java.lang.String str)
Quote a string so that it may be used in a regular expression without any parts of the string being considered as a part of the regular expression's control characters. |
static java.lang.String |
truncateNicely(java.lang.String str,
int lower,
int upper,
java.lang.String appendToEnd)
Truncates a string nicely. |
static java.lang.String |
wordWrap(java.lang.String str)
Create a word-wrapped version of a String. |
static java.lang.String |
wordWrap(java.lang.String str,
int width)
Create a word-wrapped version of a String. |
static java.lang.String |
wordWrap(java.lang.String str,
int width,
java.lang.String delim,
java.lang.String split)
Word-wrap a string. |
static java.lang.String |
wordWrap(java.lang.String str,
int width,
java.lang.String delim,
java.lang.String split,
boolean delimInside)
Word-wrap a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringW()
| Method Detail |
|---|
public static java.lang.String quoteRegularExpression(java.lang.String str)
public static java.lang.String wordWrap(java.lang.String str)
public static java.lang.String wordWrap(java.lang.String str,
int width)
public static java.lang.String wordWrap(java.lang.String str,
int width,
java.lang.String delim,
java.lang.String split)
str - String to word-wrapwidth - int to wrap atdelim - String to use to separate linessplit - String to use to split a word greater than width long
public static java.lang.String wordWrap(java.lang.String str,
int width,
java.lang.String delim,
java.lang.String split,
boolean delimInside)
str - String to word-wrapwidth - int to wrap atdelim - String to use to separate linessplit - String to use to split a word greater than width longdelimInside - wheter or not delim should be included in chunk before length reaches width.
public static java.lang.String truncateNicely(java.lang.String str,
int lower,
int upper,
java.lang.String appendToEnd)
str - String the string to be truncated.lower - int value of the lower limit.upper - int value of the upper limit, -1 if no limit is
desired. If the uppper limit is lower than the
lower limit, it will be adjusted to be same as
the lower limit.appendToEnd - String to be appended to the end of the
truncated string.
This is appended ONLY if the string was indeed
truncated. The append is does not count towards
any lower/upper limits.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||