Package org.faktorips.runtime.internal
Class IpsStringUtils
java.lang.Object
org.faktorips.runtime.internal.IpsStringUtils
A collection of utility methods for Strings. We don't use a class library like apache-commons
here to minimize the dependencies for the generated code.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
equalsNullAsEmpty
(String s1, String s2) Compares two strings, treatingnull
asEMPTY
.static boolean
Returnstrue
ifs
is eithernull
, the empty string or a string that only contains whitespace, otherwisefalse
.static boolean
Returnstrue
ifs
is eithernull
or the empty string, otherwisefalse
.static boolean
isNotBlank
(String s) Returnstrue
ifs
is neithernull
, the empty string nor a string that only contains whitespace, otherwisefalse
.static boolean
isNotEmpty
(String s) Returnstrue
ifs
is neithernull
nor the empty string, otherwisefalse
.static String
static String
Joins the elements of the providedIterable
into a single String containing the provided elements with the given separator.static <T> String
static <T> String
static String
Joins the elements of the provided array into a single String containing the provided elements with the default separator ", ".static String
Joins the elements of the provided array into a single String containing the provided elements with the given separator.static String
join
(Collection<?> collection, String separator) Joins the elements of the providedCollection
into a single String containing the provided elements with the given separator.static String
toLowerFirstChar
(String string) static boolean
trimEquals
(String s1, String s2) Trims the parameters, if the are notnull
and checks for equality usingObjects.equals(Object, Object)
.
-
Field Details
-
EMPTY
- See Also:
-
-
Method Details
-
isEmpty
Returnstrue
ifs
is eithernull
or the empty string, otherwisefalse
. -
isNotEmpty
Returnstrue
ifs
is neithernull
nor the empty string, otherwisefalse
. -
isBlank
Returnstrue
ifs
is eithernull
, the empty string or a string that only contains whitespace, otherwisefalse
. -
isNotBlank
Returnstrue
ifs
is neithernull
, the empty string nor a string that only contains whitespace, otherwisefalse
. -
trimEquals
Trims the parameters, if the are notnull
and checks for equality usingObjects.equals(Object, Object)
.- Parameters:
s1
- a strings2
- another string to be compared with a for equality- Returns:
true
if the arguments are equal to each other andfalse
otherwise
-
equalsNullAsEmpty
Compares two strings, treatingnull
asEMPTY
.- Parameters:
s1
- a strings2
- another string- Returns:
- whether both strings are equal
-
join
Joins the elements of the providedCollection
into a single String containing the provided elements with the given separator. No delimiter is added before or after the list.- Parameters:
collection
- the Collection of values to join together, may benull
separator
- the separator to use,null
treated as ""- Returns:
- the joined String, empty if the collection is
null
-
join
Joins the elements of the providedIterable
into a single String containing the provided elements with the given separator. No delimiter is added before or after the list.- Parameters:
iterable
- the Collection of values to join together, may benull
separator
- the separator to use,null
treated as ""- Returns:
- the joined String, empty if the collection is
null
-
join
Joins the elements of the providedIterable
into a single String containing the provided elements with the default separator ", ". No delimiter is added before or after the list.- Parameters:
iterable
- the Collection of values to join together, may benull
- Returns:
- the joined String, empty if the collection is
null
-
join
Joins the elements of the provided array into a single String containing the provided elements with the default separator ", ". No delimiter is added before or after the list.- Parameters:
objectArray
- the array of values to join together, may benull
- Returns:
- the joined String, empty if the collection is
null
-
join
Joins the elements of the provided array into a single String containing the provided elements with the given separator. No delimiter is added before or after the list.- Parameters:
objectArray
- the array of values to join together, may benull
separator
- the separator to use,null
treated as ""- Returns:
- the joined String, empty if the collection is
null
-
join
-
join
public static <T> String join(Iterable<T> iterable, Function<? super T, String> toString, String separator) -
toLowerFirstChar
-