Class Strings

java.lang.Object
org.apache.camel.tooling.util.Strings

public final class Strings extends Object
Some String helper methods
  • Method Details

    • 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
    • safeNull

      public static String safeNull(String text)
    • 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 text
      after - 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.
    • doubleQuote

      public static String doubleQuote(String text)
      Returns the text wrapped double quotes
    • singleQuote

      public static String singleQuote(String text)
      Returns the text wrapped single quotes
    • quote

      public static String quote(String text, String quote)
      Wraps the text in the given quote text
      Parameters:
      text - the text to wrap in quotes
      quote - 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
    • before

      public static String before(String text, String before)
    • 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
    • camelCaseToDash

      public static String camelCaseToDash(String text)
      Converts the string from camel case into dash format (helloGreatWorld -> hello-great-world)
      Parameters:
      text - the string
      Returns:
      the string camel cased