StringUtils (Apache Tomcat 10.1.48 API Documentation)
Description: declaration: package: org.apache.tomcat.util.buf, class: StringUtils

# 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 Summary

  Modifier and Type
  Method
  Description
  `static void`
  `join(Iterable<String> iterable, char separator, StringBuilder sb)`
  `static <T> void`
  `join(Iterable<T> iterable, char separator, Function<T,String> function, StringBuilder sb)`
  `static String`
  `join(String[] array)`
  `static void`
  `join(String[] array, char separator, StringBuilder sb)`
  `static String`
  `join(String a, String b)`
  `static String`
  `join(Collection<String> collection)`
  `static String`
  `join(Collection<String> collection, char separator)`
  `static <T> void`
  `join(T[] array, char separator, Function<T,String> function, StringBuilder sb)`
  `static String[]`
  `splitCommaSeparated(String s)`
  Splits a comma-separated string into an array of String values.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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.