Package org.camunda.commons.utils
Class StringUtil
java.lang.Object
org.camunda.commons.utils.StringUtil
- Author:
- Sebastian Menski
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdefaultString(String text) Returns either the passed in String, or if the String isnull, an empty String ("").static StringgetStackTrace(Throwable throwable) Fetches the stack trace of an exception as a String.static booleanisExpression(String text) Checks whether a String seams to be an expression or notstatic StringJoins a list of Strings to a single one.static String[]Splits a String by an expression.
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
isExpression
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
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
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
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
Fetches the stack trace of an exception as a String.- Parameters:
throwable- to get the stack trace from- Returns:
- the stack trace as String
-