org.apache.myfaces.trinidad.util

## Class StringUtils

- java.lang.Object
- - org.apache.myfaces.trinidad.util.StringUtils

-     public final class StringUtils
      extends Object

  This class contains String utilities. The code was taken from Apache Commons, LANG project. Reason is to provide an alternate method to java.lang.String.replace(). That method uses java.util.regex.Pattern.matcher(), which has a PERF issue.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `join(Iterator iterator, char separator)` Joins the elements of the provided `Iterator` into a single String containing the provided elements.
    `static String` | `join(Object[] array, char separator)` Joins the elements of the provided array into a single String containing the provided list of elements.
    `static String` | `replace(String text, String searchString, String replacement)`

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

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

- - ### Method Detail

    - #### replace

          public static String replace(String text,
                       String searchString,
                       String replacement)

    - #### join

          public static String join(Object[] array,
                    char separator)

      Joins the elements of the provided array into a single String containing the provided list of elements.

      No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.

           StringUtils.join(null, *) = null
           StringUtils.join([], *) = ""
           StringUtils.join([null], *) = ""
           StringUtils.join(["a", "b", "c"], ';') = "a;b;c"
           StringUtils.join(["a", "b", "c"], null) = "abc"
           StringUtils.join([null, "", "a"], ';') = ";;a"

      Parameters:
        `array` - the array of values to join together, may be null
        `separator` - the separator character to use
      Returns:
        the joined String, `null` if null array input

    - #### join

          public static String join(Iterator iterator,
                    char separator)

      Joins the elements of the provided `Iterator` into a single String containing the provided elements.

      No delimiter is added before or after the list. Null objects or empty strings within the iteration are represented by empty strings.

      See the examples here: `join(Object[],char)`.

      Parameters:
        `iterator` - the `Iterator` of values to join together, may be null
        `separator` - the separator character to use
      Returns:
        the joined String, `null` if null iterator input

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.