Skip navigation links


org.apache.myfaces.trinidad.util
Class StringUtils

java.lang.Object
  extended by org.apache.myfaces.trinidad.util.StringUtils


public final class StringUtils
extends java.lang.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
static java.lang.String join(java.util.Iterator iterator, char separator)
          Joins the elements of the provided Iterator into a single String containing the provided elements.
static java.lang.String join(java.lang.Object[] array, char separator)
          Joins the elements of the provided array into a single String containing the provided list of elements.
static java.lang.String replace(java.lang.String text, java.lang.String searchString, java.lang.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 java.lang.String replace(java.lang.String text,
                                       java.lang.String searchString,
                                       java.lang.String replacement)

join

public static java.lang.String join(java.lang.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 java.lang.String join(java.util.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

Skip navigation links


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