Class StringUtil

java.lang.Object
org.eclipse.net4j.util.StringUtil

public final class StringUtil extends Object
Various static helper methods for dealing with strings.
Author:
Eike Stepper
  • Field Details

  • Method Details

    • create

      public static String create(char c, int length)
      Since:
      3.4
    • formatException

      public static String formatException(Throwable t)
      Since:
      2.0
    • replace

      public static String replace(String text, String find, String replace)
      Since:
      3.16
    • replace

      public static String replace(String text, String[] find, String[] replace)
    • replace

      public static String replace(String str, Map<String,String> replacements)
      Since:
      3.23
    • tokenize

      public static void tokenize(String text, String separators, Consumer<String> tokenConsumer)
      Since:
      3.22
    • split

      public static List<String> split(String text, String separators, String brackets)
      Since:
      3.4
    • safe

      public static String safe(String str)
    • safe

      public static String safe(String str, String def)
      Since:
      3.4
    • safe

      public static String safe(Object object)
      Since:
      3.13
    • safe

      public static String safe(Object object, String def)
      Since:
      3.13
    • escape

      public static String escape(String str)
      Since:
      3.22
    • escape

      public static String escape(String str, char separator)
      Since:
      3.22
    • unescape

      public static String unescape(String str)
      Since:
      3.22
    • unescape

      public static String unescape(String str, char separator)
      Since:
      3.22
    • compare

      public static int compare(String s1, String s2)
    • compareIgnoreCase

      public static int compareIgnoreCase(String s1, String s2)
      Since:
      3.23
    • equalsIgnoreCase

      public static boolean equalsIgnoreCase(String s1, String s2)
      Since:
      3.23
    • isTrue

      public static boolean isTrue(String s)
      Since:
      3.22
    • isFalse

      public static boolean isFalse(String s)
      Since:
      3.22
    • capAll

      public static String capAll(String str)
      Since:
      2.0
    • cap

      public static String cap(String str)
    • uncapAll

      public static String uncapAll(String str)
      Since:
      2.0
    • uncap

      public static String uncap(String str)
    • occurrences

      public static int occurrences(String str, char c)
    • occurrences

      public static int occurrences(String str, String c)
    • translate

      public static String translate(String str, String from, String to)
      Since:
      3.8
    • convert

      public static String convert(String str, IManagedContainer container)
      Since:
      3.23
    • convert

      public static String convert(String str, IManagedContainer container, Pattern pattern)
      Since:
      3.23
    • parse

      public static <T> T parse(String str, IManagedContainer container, Class<T> type)
      Since:
      3.23
    • parse

      public static <T> T parse(String str, IManagedContainer container, Class<T> type, boolean enumCaseSensitive)
      Since:
      3.23
    • isEmpty

      public static boolean isEmpty(String str)
    • appendSeparator

      public static boolean appendSeparator(StringBuilder builder, String str)
      Since:
      3.16
    • appendSeparator

      public static boolean appendSeparator(StringBuilder builder, char c)
      Since:
      3.16
    • glob

      public static boolean glob(String pattern, String string)
      Matches a string against a pattern.

      Pattern description:

      • * matches 0 or more characters
      • ? matches a single character
      • [...] matches a set and/or range of characters
      • \ escapes the following character
      Since:
      2.0
    • glob

      public static boolean glob(String pattern, String string, String[] subStrings)
      Matches a string against a pattern and fills an array with the sub-matches.

      Pattern description:

      • * matches 0 or more characters
      • ? matches a single character
      • [...] matches a set and/or range of characters
      • \ escapes the following character
      Since:
      2.0
    • equalsUpperOrLowerCase

      @Deprecated public static boolean equalsUpperOrLowerCase(String s, String upperOrLowerCase)
      Deprecated.
      Since:
      3.1