Package org.camunda.commons.utils
Class StringUtil
- java.lang.Object
-
- org.camunda.commons.utils.StringUtil
-
public final class StringUtil extends java.lang.Object- Author:
- Sebastian Menski
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringdefaultString(java.lang.String text)Returns either the passed in String, or if the String isnull, an empty String ("").static java.lang.StringgetStackTrace(java.lang.Throwable throwable)Fetches the stack trace of an exception as a String.static booleanisExpression(java.lang.String text)Checks whether a String seams to be an expression or notstatic java.lang.Stringjoin(java.lang.String delimiter, java.lang.String... parts)Joins a list of Strings to a single one.static java.lang.String[]split(java.lang.String text, java.lang.String regex)Splits a String by an expression.
-
-
-
Method Detail
-
isExpression
public static boolean isExpression(java.lang.String text)
Checks whether a String seams to be an expression or not- Parameters:
text- the text to check- Returns:
- true if the text seams to be an expression false otherwise
-
split
public static java.lang.String[] split(java.lang.String text, java.lang.String regex)Splits a String by an expression.- Parameters:
text- the text to splitregex- the regex to split by- Returns:
- the parts of the text or null if text was null
-
join
public static java.lang.String join(java.lang.String delimiter, java.lang.String... parts)Joins a list of Strings to a single one.- Parameters:
delimiter- the delimiter between the joined partsparts- the parts to join- Returns:
- the joined String or null if parts was null
-
defaultString
public static java.lang.String defaultString(java.lang.String text)
Returns either the passed in String, or if the String isnull, an empty String ("").StringUtils.defaultString(null) = "" StringUtils.defaultString("") = "" StringUtils.defaultString("bat") = "bat"- Parameters:
text- the String to check, may be null- Returns:
- the passed in String, or the empty String if it was
null
-
getStackTrace
public static java.lang.String getStackTrace(java.lang.Throwable throwable)
Fetches the stack trace of an exception as a String.- Parameters:
throwable- to get the stack trace from- Returns:
- the stack trace as String
-
-