org.sape.carbon.core.util.string
Class StringUtil

java.lang.Object
  |
  +--org.sape.carbon.core.util.string.StringUtil

public class StringUtil
extends Object

Utilities for strings.

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.5 $($Author: dvoet $ / $Date: 2003/05/05 21:21:24 $)
Author:
Greg Hinkle, May 2002

Constructor Summary
StringUtil()
           
 
Method Summary
static String capitalize(String s)
          Capitalizes the first character of the given string.
static Set convertToSet(char[] charArray)
           Converts a char array to a Set.
static Set convertToSet(String string)
           Converts a string to a Set.
static String[] parseCommaDelimitedList(String csvList)
          Parses a comma-separated list into an array of Strings Values can contain whitespace, but whitespace at the beginning and end of each value is trimmed.
static String[] parseList(String list, String delim)
          Parses a list according to the specified delimiter into an array of Strings.
static String[] parseWhitespaceDelimitedList(String wsvList)
          Parses a whitepsace-separated list into an array of Strings
static String removeCharsFromString(String aString, char[] unWantedCharArray)
          Removes specified chars from a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

capitalize

public static String capitalize(String s)
Capitalizes the first character of the given string.

Parameters:
s - the String to capitalize
Returns:
the capitalized result

parseCommaDelimitedList

public static String[] parseCommaDelimitedList(String csvList)
Parses a comma-separated list into an array of Strings Values can contain whitespace, but whitespace at the beginning and end of each value is trimmed.

Parameters:
csvList - a string of comma seperated values
Returns:
array of Strings

parseWhitespaceDelimitedList

public static String[] parseWhitespaceDelimitedList(String wsvList)
Parses a whitepsace-separated list into an array of Strings

Parameters:
wsvList - a string of white space seperated values
Returns:
array of Strings

parseList

public static String[] parseList(String list,
                                 String delim)
Parses a list according to the specified delimiter into an array of Strings.

Parameters:
list - a string of token seperated values
delim - the delimiter character(s). Each character in the string is a single delimeter.
Returns:
an array of strings
See Also:
StringTokenizer

removeCharsFromString

public static String removeCharsFromString(String aString,
                                           char[] unWantedCharArray)

Removes specified chars from a string.

Parameters:
aString - the string that will be examined to remove chars
unWantedCharArray - the char array containing the chars that should be removed from a string
Returns:
the string after removing the specified chars

convertToSet

public static Set convertToSet(String string)

Converts a string to a Set. Breaks the string to characters and store each character in a Set.

Parameters:
string - the string to convert
Returns:
a Set containing all characters in the text string parameter

convertToSet

public static Set convertToSet(char[] charArray)

Converts a char array to a Set. Puts all characters in the array to a Set.

Parameters:
charArray - an array of chars
Returns:
a set containing all characters in the char array


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.