Package org.apache.camel.tooling.util
Class Strings
- java.lang.Object
-
- org.apache.camel.tooling.util.Strings
-
public final class Strings extends Object
Some String helper methods
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringafter(String text, String after)Returns the string after the given tokenstatic StringasTitle(String name)Capitalizes the name as a titlestatic Stringbefore(String text, String before)static Stringbetween(String text, String after, String before)Clips the text between the start and end markersstatic StringcamelCaseToDash(String text)Converts the string from camel case into dash format (helloGreatWorld -> hello-great-world)static StringcamelDashToTitle(String value)Converts the value to use title style instead of dash casedstatic StringcanonicalClassName(String className)Returns the canonical class name by removing any generic type information.static StringdoubleQuote(String text)Returns the text wrapped double quotesstatic StringgetOrElse(String text, String defaultValue)Returns the value or the defaultValue if it is nullstatic StringindentCollection(String indent, Collection<String> list)static booleanisEmpty(String s)static booleanisNullOrEmpty(String text)Returns true if the given text is null or empty string or has null as the valuestatic Stringquote(String text, String quote)Wraps the text in the given quote textstatic StringsafeNull(String text)static StringsingleQuote(String text)Returns the text wrapped single quotes
-
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(String s)
-
isNullOrEmpty
public static boolean isNullOrEmpty(String text)
Returns true if the given text is null or empty string or has null as the value
-
getOrElse
public static String getOrElse(String text, String defaultValue)
Returns the value or the defaultValue if it is null
-
after
public static String after(String text, String after)
Returns the string after the given token- Parameters:
text- the textafter- the token- Returns:
- the text after the token, or null if text does not contain the token
-
canonicalClassName
public static String canonicalClassName(String className)
Returns the canonical class name by removing any generic type information.
-
quote
public static String quote(String text, String quote)
Wraps the text in the given quote text- Parameters:
text- the text to wrap in quotesquote- the quote text added to the prefix and postfix of the text- Returns:
- the text wrapped in the given quotes
-
between
public static String between(String text, String after, String before)
Clips the text between the start and end markers
-
asTitle
public static String asTitle(String name)
Capitalizes the name as a title- Parameters:
name- the name- Returns:
- as a title
-
indentCollection
public static String indentCollection(String indent, Collection<String> list)
-
camelDashToTitle
public static String camelDashToTitle(String value)
Converts the value to use title style instead of dash cased
-
-