Class StringUtils
java.lang.Object
org.apache.ivy.util.StringUtils
Convenient class used only for uncapitalization. Usually use commons lang but here we do not want
to have such a dependency for only one feature
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertNotNullNorEmpty(String value, String errorMessage) Asserts that the passedvalueis not null and not an emptyString.static voidassertNotNullNotEmpty(String value, String errorMessage) Deprecated.static final StringDecrypts a string encrypted with encrypt.static final StringEncrypt the given string in a way which anybody having access to this method algorithm can easily decrypt.static StringReturns the error message associated with the given Throwable.static StringReturns the exception stack trace as a String.static booleanstatic StringDeprecated.static StringJoins the given string array in one string, each separated by the given separator.static Stringstatic String[]splitToArray(String list) Splits the given string into a string array using comma as a separator.static Stringuncapitalize(String string)
-
Method Details
-
uncapitalize
-
getErrorMessage
Returns the error message associated with the given Throwable. The error message returned will try to be as precise as possible, handling cases where e.getMessage() is not meaningful, likeNullPointerExceptionfor instance.- Parameters:
t- the throwable to get the error message from- Returns:
- the error message of the given exception
-
getStackTrace
-
join
Deprecated. -
joinArray
Joins the given string array in one string, each separated by the given separator. Example:joinArray(new String[] {"one", "two", "three"}, ", ") -> "one, two, three"- Parameters:
objs- The array of strings.sep- The separator to use.- Returns:
- The concatenated string.
-
splitToArray
-
isNullOrEmpty
-
assertNotNullNorEmpty
Asserts that the passedvalueis not null and not an emptyString. The implementation of this methodtrimsthe (non-null)valueto check whether the value is an empty string. If thevalueis either null or empty, then this method throws anIllegalArgumentExceptionwith the passederrorMessageas the message in the exception.- Parameters:
value- The value to check forerrorMessage- The error message
-
assertNotNullNotEmpty
Deprecated. -
encrypt
Encrypt the given string in a way which anybody having access to this method algorithm can easily decrypt. This is useful only to avoid clear string storage in a file for example, but shouldn't be considered as a real mean of security. This only works with simple characters (char < 256).- Parameters:
str- the string to encrypt- Returns:
- the encrypted version of the string
-
decrypt
-
repeat
-