|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--de.hunsicker.util.StringHelper
String related helper functions.
| Field Summary | |
static int |
TRIM_ALL
Trim both leading and trailing whitespace. |
static int |
TRIM_LEADING
Trim only leading whitespace. |
static int |
TRIM_NONE
No trimming. |
| Method Summary | |
static boolean |
containsUppercase(java.lang.String str)
Returns true if the given string contains at least one uppercase
letter. |
static java.lang.String |
getClassName(java.lang.String qualifiedName)
Returns the name part of the given qualified java class name. |
static java.lang.String |
getPackageName(java.lang.String name)
Returns the package name of the given Java class name. |
static int |
indexOf(char character,
java.lang.String str,
int x)
Returns the index within the given string of the x. occurrence of the specified character. |
static int |
indexOfNonWhitespace(java.lang.String str)
Returns the offset of the first non-whitespace character of the given string. |
static int |
indexOfNonWhitespace(java.lang.String str,
int beginOffset)
Returns the offset of the first non-whitespace character of the given string. |
static boolean |
isNumber(java.lang.String str)
Checks whether the given string represents a number. |
static boolean |
isUppercase(char letter)
Returns true if the given letter is uppercase. |
static java.lang.String |
leftPad(java.lang.String str,
int size)
Left pad a String with spaces. |
static java.lang.String |
leftPad(java.lang.String str,
int size,
java.lang.String delim)
Left pad a String with a specified string. |
static java.lang.String |
lowercaseFirst(java.lang.String str)
Returns the given string with the first letter converted to lower case. |
static int |
occurs(char character,
char[] string)
Returns the number of occurrences of character in string. |
static int |
occurs(char character,
java.lang.String string)
Returns the number of occurrences of character in string. |
static java.lang.String |
repeat(java.lang.String str,
int repeat)
Repeat a string n times to form a new string. |
static java.lang.String |
replace(java.lang.String original,
java.lang.String replaceFrom,
java.lang.String replaceTo)
Searchs and replaces fixed string matches within the given string. |
static java.lang.String[] |
split(java.lang.String str,
java.lang.String delim)
Splits the given string into chunks. |
static boolean |
startsWithUppercase(java.lang.String str)
Returns true if the given string starts with an uppercase letter. |
static java.lang.String |
trimTrailing(java.lang.String str)
Removes trailing whitespace from the given string. |
static java.lang.String |
wrapString(java.lang.String str,
int width,
boolean removeNewLines)
Wraps multi-line strings. |
static java.lang.String[] |
wrapStringToArray(java.lang.String str,
int width,
java.text.BreakIterator breakIter,
java.lang.String lineSeparator,
boolean removeNewLines,
int trimPolicy)
Wraps multi-line strings (and get the individual lines). |
static java.lang.String[] |
wrapStringToArray(java.lang.String str,
int width,
java.lang.String lineSeparator,
boolean removeNewLines,
int trimPolicy)
Wraps multi-line strings (and returns the individual lines). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int TRIM_ALL
public static final int TRIM_LEADING
public static final int TRIM_NONE
| Method Detail |
public static java.lang.String getClassName(java.lang.String qualifiedName)
qualifiedName - name for which the name part should be returned.
null if the given name
was null itself.getPackageName(java.lang.String)public static boolean isNumber(java.lang.String str)
str - string to check.
true if str represents a number.public static java.lang.String getPackageName(java.lang.String name)
name - class name for which the package name should be returned.
getClassName(java.lang.String)public static boolean isUppercase(char letter)
true if the given letter is uppercase.
letter - letter to check for capitalization.
true if the given letter is uppercase.public static boolean containsUppercase(java.lang.String str)
true if the given string contains at least one uppercase
letter.
str - string to check for uppercase letters.
true if the given string contains at least one uppercase
letter.
public static int indexOf(char character,
java.lang.String str,
int x)
character - character to search.str - the string to search.x - x. occurrence of the character to search for.
-1 if the specified character is
not contained in the given string or it occurs less than the specified
occurrence to look for.public static int indexOfNonWhitespace(java.lang.String str)
str - a string.
-1 if no non-whitespace character could be found.
public static int indexOfNonWhitespace(java.lang.String str,
int beginOffset)
str - a string.beginOffset - DOCUMENT ME!
-1 if no non-whitespace character could be found.
java.lang.IllegalArgumentException - DOCUMENT ME!
public static java.lang.String leftPad(java.lang.String str,
int size)
str - String to pad outsize - int size to pad to
public static java.lang.String leftPad(java.lang.String str,
int size,
java.lang.String delim)
str - String to pad outsize - int size to pad todelim - String to pad with
public static java.lang.String lowercaseFirst(java.lang.String str)
str - string to transform.
public static int occurs(char character,
char[] string)
character - character to search for.string - character array to search.
0 if no occurrences could be found.
public static int occurs(char character,
java.lang.String string)
character - character to search for.string - string to search.
0 if no occurrences could be found.
public static java.lang.String repeat(java.lang.String str,
int repeat)
str - String to repeatrepeat - int number of times to repeat
public static java.lang.String replace(java.lang.String original,
java.lang.String replaceFrom,
java.lang.String replaceTo)
original - the original string.replaceFrom - the substring to be find.replaceTo - the substring to replace it with.
public static java.lang.String[] split(java.lang.String str,
java.lang.String delim)
str - string to split into chunks.delim - the delimeter to use for splitting.
public static boolean startsWithUppercase(java.lang.String str)
true if the given string starts with an uppercase letter.
str - string to check.
true if the given string starts with an uppercase letter.public static java.lang.String trimTrailing(java.lang.String str)
str - the string to trim.
public static java.lang.String wrapString(java.lang.String str,
int width,
boolean removeNewLines)
str - the string to wrap.width - the maximum width of lines.removeNewLines - if true, any newlines in the original string
are ignored.
public static java.lang.String[] wrapStringToArray(java.lang.String str,
int width,
java.lang.String lineSeparator,
boolean removeNewLines,
int trimPolicy)
str - the string to wrap.width - the maximum width of each line.lineSeparator - the lineSeparator string used for newlines.removeNewLines - if true, any newlines in the original string
are ignored.trimPolicy - trim the resulting lines according to the given policy.
public static java.lang.String[] wrapStringToArray(java.lang.String str,
int width,
java.text.BreakIterator breakIter,
java.lang.String lineSeparator,
boolean removeNewLines,
int trimPolicy)
str - the string to wrap.width - the maximum width of each line.breakIter - the iterator to use to break the string into chunks.lineSeparator - the lineSeparator string used for newlines.removeNewLines - if true, any newlines in the original string
are ignored.trimPolicy - trim the resulting lines according to the given policy.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||