geocaching.api.util
Class StringUtils

java.lang.Object
  extended by geocaching.api.util.StringUtils

public class StringUtils
extends Object

This is a part of original StringUtils.java from Apache Commons lib.

Since:
1.0
Version:
$Id: StringUtils.java,v 1.130 2004/05/24 20:15:44 fredrik Exp $
Author:
Apache Jakarta Turbine, GenerationJavaCore, Jon S. Stevens, Daniel Rall, Greg Coladonato, Henri Yandell, Ed Korthof, Rand McNeely, Stephen Colebourne, Fredrik Westermarck, Holger Krauth, Alexander Day Chaffee, Henning P. Schmiedehausen, Arun Mammen Thomas, Gary Gregory, Phil Steitz, Al Chou, Michael Davey
See Also:
String

Field Summary
static String EMPTY
          The empty String "".
 
Constructor Summary
StringUtils()
           
 
Method Summary
static String concatenate(Object[] array)
          Deprecated. Use the better named join(Object[]) instead. Method will be removed in Commons Lang 3.0.
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(Iterator iterator, String separator)
          Joins the elements of the provided Iterator into a single String containing the provided elements.
static String join(Object[] array)
          Joins the elements of the provided array into a single String containing the provided list of 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 join(Object[] array, String separator)
          Joins the elements of the provided array into a single String containing the provided list of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final String EMPTY
The empty String "".

Since:
2.0
See Also:
Constant Field Values
Constructor Detail

StringUtils

public StringUtils()
Method Detail

concatenate

@Deprecated
public static String concatenate(Object[] array)
Deprecated. Use the better named join(Object[]) instead. Method will be removed in Commons Lang 3.0.

Concatenates elements of an array into a single String. Null objects or empty strings within the array are represented by empty strings.

 StringUtils.concatenate(null)            = null
 StringUtils.concatenate([])              = ""
 StringUtils.concatenate([null])          = ""
 StringUtils.concatenate(["a", "b", "c"]) = "abc"
 StringUtils.concatenate([null, "", "a"]) = "a"
 

Parameters:
array - the array of values to concatenate, may be null
Returns:
the concatenated String, null if null array input

join

public static String join(Object[] array)

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

No separator is added to the joined String. 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"]) = "abc"
 StringUtils.join([null, "", "a"]) = "a"
 

Parameters:
array - the array of values to join together, may be null
Returns:
the joined String, null if null array input
Since:
2.0

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
Since:
2.0

join

public static String join(Object[] array,
                          String 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. A null separator is the same as an empty String (""). 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(["a", "b", "c"], "")    = "abc"
 StringUtils.join([null, "", "a"], ',')   = ",,a"
 

Parameters:
array - the array of values to join together, may be null
separator - the separator character to use, null treated as ""
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
Since:
2.0

join

public static String join(Iterator iterator,
                          String 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. A null separator is the same as an empty String ("").

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

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


Copyright © 2012. All Rights Reserved.