public final class StringUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
assertNotNullNorEmpty(java.lang.String value,
java.lang.String errorMessage)
Asserts that the passed
value is not null and not an empty String . |
static void |
assertNotNullNotEmpty(java.lang.String value,
java.lang.String errorMessage)
Deprecated.
|
static java.lang.String |
decrypt(java.lang.String str)
Decrypts a string encrypted with encrypt.
|
static java.lang.String |
encrypt(java.lang.String str)
Encrypt the given string in a way which anybody having access to this method algorithm can
easily decrypt.
|
static java.lang.String |
getErrorMessage(java.lang.Throwable t)
Returns the error message associated with the given Throwable.
|
static java.lang.String |
getStackTrace(java.lang.Throwable e)
Returns the exception stack trace as a String.
|
static boolean |
isNullOrEmpty(java.lang.String s)
Checks that a string is not null or consists of whitespace by
trimming
and checking the length of the result. |
static java.lang.String |
join(java.lang.Object[] objs,
java.lang.String sep)
Deprecated.
|
static java.lang.String |
joinArray(java.lang.String[] objs,
java.lang.String sep)
Joins the given string array in one string, each separated by the given separator.
|
static java.lang.String |
repeat(java.lang.String str,
int count) |
static java.lang.String[] |
splitToArray(java.lang.String list)
Splits the given string into a string array using comma as a separator.
|
static java.lang.String |
uncapitalize(java.lang.String string) |
public static java.lang.String uncapitalize(java.lang.String string)
public static java.lang.String getErrorMessage(java.lang.Throwable t)
NullPointerException
for instance.t
- the throwable to get the error message frompublic static java.lang.String getStackTrace(java.lang.Throwable e)
e
- the exception to get the stack trace from.@Deprecated public static java.lang.String join(java.lang.Object[] objs, java.lang.String sep)
public static java.lang.String joinArray(java.lang.String[] objs, java.lang.String sep)
joinArray(new String[] {"one", "two", "three"}, ", ") -> "one, two, three"
objs
- The array of strings.sep
- The separator to use.public static java.lang.String[] splitToArray(java.lang.String list)
trimmed
.list
- the stringpublic static boolean isNullOrEmpty(java.lang.String s)
trimming
and checking the length
of the result.s
- the string to checkpublic static void assertNotNullNorEmpty(java.lang.String value, java.lang.String errorMessage)
value
is not null and not an empty String
.
The implementation of this method trims
the (non-null)
value
to check whether the value is an empty string. If the value
is either null or empty, then this method throws an IllegalArgumentException
with the passed errorMessage
as the message in the exception.value
- The value to check forerrorMessage
- The error message@Deprecated public static void assertNotNullNotEmpty(java.lang.String value, java.lang.String errorMessage)
public static final java.lang.String encrypt(java.lang.String str)
str
- the string to encryptpublic static final java.lang.String decrypt(java.lang.String str)
str
- the encrypted string to decryptpublic static java.lang.String repeat(java.lang.String str, int count)
Copyright ©2007-2020 The Apache Software Foundation, Licensed under Apache License, Version 2.0.