Class StringUtils

java.lang.Object
org.apache.tomcat.util.buf.StringUtils

public final class StringUtils extends Object
Utility methods to build a separated list from a given set (not java.util.Set) of inputs and return that list as a string or append it to an existing StringBuilder. If the given set is null or empty, an empty string will be returned.
  • Method Details

    • join

      public static String join(String a, String b)
    • join

      public static String join(String[] array)
    • join

      public static void join(String[] array, char separator, StringBuilder sb)
    • join

      public static String join(Collection<String> collection)
    • join

      public static String join(Collection<String> collection, char separator)
    • join

      public static void join(Iterable<String> iterable, char separator, StringBuilder sb)
    • join

      public static <T> void join(T[] array, char separator, Function<T,String> function, StringBuilder sb)
    • join

      public static <T> void join(Iterable<T> iterable, char separator, Function<T,String> function, StringBuilder sb)
    • splitCommaSeparated

      public static String[] splitCommaSeparated(String s)
      Splits a comma-separated string into an array of String values. Whitespace around the commas is removed. Null or empty values will return a zero-element array.
      Parameters:
      s - The string to split by commas.
      Returns:
      An array of String values.