Package org.apache.tomcat.util.buf

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

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`StringUtils.Function<T>`

## 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, StringUtils.Function<T> function, StringBuilder sb)`
`static String`
`join(String[] array)`
`static void`
`join(String[] array, char separator, StringBuilder sb)`
`static String`
`join(Collection<String> collection)`
`static String`
`join(Collection<String> collection, char separator)`
`static <T> void`
`join(T[] array, char separator, StringUtils.Function<T> function, StringBuilder sb)`
`static String[]`
`splitCommaSeparated(String s)`
Splits a comma-separated string into an array of String values.

### Methods inherited from class java.lang.Object

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

## Method Details

### 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, StringUtils.Function<T> function, StringBuilder sb)

### join

public static <T> void join(Iterable<T> iterable, char separator, StringUtils.Function<T> 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.