Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.javatest.util
Class StringArray

    java.lang.Object
      com.sun.javatest.util.StringArray

    public class StringArray

extends java.lang.Object

A class to convert to and from a single string with space separated substrings.

Constructor Summary
`StringArray()`

Method Summary
`static boolean` | `contains(java.lang.String[] list, java.lang.String target)` Does the string array contain the target string? Since the list is assumed to have no particular structure, the performance of this search is O(n).
`static boolean` | `contains(java.lang.String list, java.lang.String target)` Does the list contain the target string? This method is string parsing intensive, use with caution.
`static java.lang.String` | `join(java.lang.String[] ss)` Converts an array of strings into a single space separated string.
`static java.lang.String` | `join(java.lang.String[] ss, java.lang.String sep)` Converts an array of strings into a single string, * using a specified separator.
`static java.lang.String[]` | `split(java.lang.String s)` Convert a single whitespace separated string into it's component substrings.
`static java.lang.String[]` | `splitList(java.lang.String list, java.lang.String delim)` Split up a comma separated list of values.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StringArray

    public StringArray()

Method Detail

### split

    public static java.lang.String[] split(java.lang.String s)

  Convert a single whitespace separated string into it's component substrings. The substrings can be separated by one or more instances of a space (' '), tab ('\t') or newline ('\n').

  Parameters:
    `s` - The string to break apart. A null string will not cause an error.
  Returns:
    Provides the substrings of the given parameter. If the provided string was null or all whitespace, an empty array (length==0) is returned.

### join

    public static java.lang.String join(java.lang.String[] ss)

  Converts an array of strings into a single space separated string. The strings are appended to the resulting string in ascending index order, left to right. A single space character is used to delimit the values in the resulting string.

  Parameters:
    `ss` - The strings which should be concatenated together. A zero length or null value will not cause an error.
  Returns:
    The string which is made up of all the strings provided. The return value is a zero length string if the input value was null or zero length.

### join

    public static java.lang.String join(java.lang.String[] ss,
                                        java.lang.String sep)

  Converts an array of strings into a single string, * using a specified separator. The strings are appended to the resulting string in ascending index order, left to right. A specified separator is used to delimit the values in the resulting string.

  Parameters:
    `ss` - The strings which should be concatenated together. A zero length or null value will not cause an error.
    `sep` - The separator to place between the elements of the string array in the concatenated result
  Returns:
    The string which is made up of all the strings provided. The return value is a zero length string if the input value was null or zero length.

### splitList

    public static java.lang.String[] splitList(java.lang.String list,
                                               java.lang.String delim)

  Split up a comma separated list of values. Whitespace after each delimiter is removed.

  Parameters:
    `list` - The string to parse for items. Null or zero length strings ok.
    `delim` - The string which separates items in the list. Must be non-null and have a length greater than zero.
  Returns:
    The extracted items from the list. Will only be null if the input string is null or zero length.

### contains

    public static boolean contains(java.lang.String[] list,
                                   java.lang.String target)

  Does the string array contain the target string? Since the list is assumed to have no particular structure, the performance of this search is O(n).

  Parameters:
    `list` - The list of strings to search, null is ok.
  Returns:
    True if it does, false otherwise. Will the false if the list was null.

### contains

    public static boolean contains(java.lang.String list,
                                   java.lang.String target)

  Does the list contain the target string? This method is string parsing intensive, use with caution.

  Returns:
    True if it does, false otherwise.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.