|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.protempore.utils.StringUtils
public final class StringUtils
A string utility class.
| Method Summary | |
|---|---|
static java.lang.String |
capitalize(java.lang.String str)
Capitalize the first letter of the given string, if necessary, returning str if it is null or empty
or already capitalized. |
static java.lang.String |
capitalizeInitials(java.lang.String str,
char sep)
Capitalize the first word of a given string, using the given sep character to determine word
boundaries, and returning the original string if it was null or empty. |
static java.lang.String |
closestAscii(java.lang.String str)
Return closest ascii representation of a non-null string, or null for a null reference. |
static boolean |
isEmpty(java.lang.String s)
A null-safe method that returns true if and only if the given string reference is null or refers to an empty string. |
static java.lang.String |
makeRandomString(char[] validChars,
int strLen)
Create a random string consisting of strLen characters randomly drawn from the given array of valid
characters, which must be a non-null array containing at least 1 character. |
static java.lang.String |
nullSafeTrim(java.lang.String s)
A trim method that handles null references by returning null and otherwise performing the normal String.trim(). |
static java.lang.String |
uncapitalize(java.lang.String str)
Uncapitalize the first letter of the given string, if necessary, returning str if it is null or
empty or already uncapitalized. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String closestAscii(java.lang.String str)
str - A string.
public static java.lang.String uncapitalize(java.lang.String str)
str if it is null or
empty or already uncapitalized.
str - A string reference.
public static java.lang.String capitalize(java.lang.String str)
str if it is null or empty
or already capitalized.
str - A string reference.
public static java.lang.String capitalizeInitials(java.lang.String str,
char sep)
sep character to determine word
boundaries, and returning the original string if it was null or empty.
str - A string.sep - The separator character to use for determining word boundaries (e.g., ' ' for space-delimited, ',' for
comma-delimited).
public static java.lang.String nullSafeTrim(java.lang.String s)
String.trim().
s - A reference to a string, possibly null.
s is null, otherwise the trimmed string.public static boolean isEmpty(java.lang.String s)
s - A string reference, or null.
s is null or empty.
public static java.lang.String makeRandomString(char[] validChars,
int strLen)
strLen characters randomly drawn from the given array of valid
characters, which must be a non-null array containing at least 1 character.
validChars - A non-null array of 1 or more characters, from which will be drawn the characters of the string
to be created.strLen - The length of the string to be created, which must be non-negative.
strLen containing only characters drawn from the
validChars array.
ValidationException - If validChars is null or empty or strLen is negative.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||