|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.empire.commons.StringUtils
public class StringUtils
This class contains common functions for comparing and converting values of type String.
Method Summary | |
---|---|
static java.lang.String |
arrayToString(java.lang.Object[] array,
java.lang.String separator)
Converts an array of objects to a string. |
static java.lang.String |
coalesce(java.lang.String preferred,
java.lang.String alternative)
Returns the preferred String if it is not empty ot the alternative String otherwise. |
static boolean |
isEmpty(java.lang.String s)
Checks if a string is empty |
static boolean |
isValid(java.lang.String s)
Checks if a string is not null or empty |
static java.lang.String |
nullIfEmpty(java.lang.Object value)
Returns null if the value supplied is null or an empty String. |
static java.lang.String |
replace(java.lang.String source,
java.lang.String find,
java.lang.String replace)
Replaces all occurences of find in source by replace. |
static java.lang.String |
replaceAll(java.lang.String source,
java.lang.String find,
java.lang.String replace)
Returns a String with all occurrences of from within orig replaced with to . |
static java.lang.String |
toString(java.lang.Object value)
Converts a value to a string. |
static java.lang.String |
toString(java.lang.Object[] array)
Converts an array of objects to a string. |
static java.lang.String |
toString(java.lang.Object[] array,
java.lang.String defValue)
Converts an array of objects to a string. |
static java.lang.String |
toString(java.lang.Object value,
java.lang.String defValue)
Converts a value to a string. |
static java.lang.String |
validate(java.lang.String s)
Validates a given string. |
static java.lang.String |
valueOf(java.lang.Object value)
Converts a value to a string. |
static java.lang.String |
valueOf(java.lang.Object[] array)
Converts an objects to a string. |
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 toString(java.lang.Object value, java.lang.String defValue)
value
- the value to convertdefValue
- default value which to return if value is null
public static java.lang.String toString(java.lang.Object value)
value
- the value to convert
public static java.lang.String toString(java.lang.Object[] array, java.lang.String defValue)
array
- array of objectsdefValue
- default value which to return if array is null
public static java.lang.String toString(java.lang.Object[] array)
array
- array of objects
public static java.lang.String valueOf(java.lang.Object value)
value
- the value to convert
public static java.lang.String valueOf(java.lang.Object[] array)
array
- array of objects
public static java.lang.String coalesce(java.lang.String preferred, java.lang.String alternative)
preferred
- the preferred Stringalternative
- the alternative String if the preferred String is not valid
public static java.lang.String nullIfEmpty(java.lang.Object value)
value
- the value to check
public static java.lang.String arrayToString(java.lang.Object[] array, java.lang.String separator)
array
- array of objectsseparator
- the separator to put between the object strings
public static boolean isEmpty(java.lang.String s)
s
- the String to check
null
public static boolean isValid(java.lang.String s)
s
- the string to validate
public static java.lang.String validate(java.lang.String s)
s
- the string to validate
public static java.lang.String replace(java.lang.String source, java.lang.String find, java.lang.String replace)
source
- the original String.find
- the String to be replacedreplace
- the replacement string
find
in source
replaced by replace
public static java.lang.String replaceAll(java.lang.String source, java.lang.String find, java.lang.String replace)
from
within orig
replaced with to
.
If orig
contains no occurrences of from
, or if from
is equal to
to
,orig
itself is returned rather than a copy being made. If orig is null
,
null
is returned.
source
- the original String.find
- the String to be replacedreplace
- the replacement string
find
in source
replaced by replace
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |