com.bowstreet.util
Class StringUtil

java.lang.Object
  extended by com.bowstreet.util.StringUtil

public class StringUtil
extends java.lang.Object

The StringUtil class can be used as a simplified mechanism for concatenating an arbitrary number of string objects.


Field Summary
static java.lang.String newline
           
 
Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String buildDelimitedString(java.util.List items, char delimiter)
          Builds a delimited String from the specified list of objects.
static java.lang.String cleanIdentifier(java.lang.String id)
          Convert arbitrary Unicode string into one consisting of only ASCII letters, numbers and underscore.
static boolean contains(java.lang.String[] array, java.lang.String test)
          Test if a string array contains a certain string.
static boolean equals(java.lang.String string1, java.lang.String string2)
          Compares two string for equality.
static java.lang.String fixUpFilename(java.lang.String filename, java.lang.String ext)
           
static java.lang.String getCompleteExceptionText(java.lang.Throwable ex)
          Make an error string from an exception, including the stack trace
static java.lang.String getSafeXMLName(java.lang.String oldValue)
          Create a name that's safe to be used as the name of an XML element.
static java.lang.String getSafeXMLName(java.lang.String oldValue, boolean allowDot)
          Create a name that's safe to be used as the name of an XML element.
static java.lang.String getStackTraceAsString(java.lang.Throwable ex)
          Get the stack trace from an exception
static boolean isEmpty(java.lang.String str)
          Test given string argument to see if it represents an empty string.
static boolean isJavaIdentifier(java.lang.String s)
           
static java.lang.String lcFirstChar(java.lang.String s)
          Returns the passed in String as a new String with the first char converted to lower case.
static void main(java.lang.String[] args)
           
static java.lang.String ncrDecode(java.lang.String s)
          Decode all numeric character references (NCR) in a string.
static java.lang.String ncrEncode(java.lang.String s, int lowerInclusive, int upperInclusive)
          Encode out-of-range characters in a string as numeric character references (NCR).
static java.lang.String normalize(java.lang.String value)
          Normalize a string to be null if it only contains whitespace or is an empty string.
static java.util.List parseDelimitedList(java.lang.String delimitedList)
          This method parses a comma delimited list into List object.
static java.lang.String printf(java.lang.String formatString, java.lang.Object value)
          A shortcut for using the MessageFormat class, where all the arguments are strings
static java.lang.String printf(java.lang.String formatString, java.lang.Object value0, java.lang.Object value1)
          A shortcut for using the MessageFormat class, where all the arguments are strings
static java.lang.String printf(java.lang.String formatString, java.lang.Object value0, java.lang.Object value1, java.lang.Object value2)
          A shortcut for using the MessageFormat class, where all the arguments are strings
static java.lang.String printf(java.lang.String formatString, java.lang.Object value0, java.lang.Object value1, java.lang.Object value2, java.lang.Object value3)
          A shortcut for using the MessageFormat class, where all the arguments are strings
static java.lang.String replace(java.lang.String source, java.lang.String target, java.lang.String replacement)
          Routine to effect n-ary substitution of one string for another
static int safeParseInt(java.lang.String str, int defaultVal)
          Safely parse a string containing an integer.
static int safeParseInt(java.lang.String str, int radix, int defaultVal)
          Safely parse a string containing an integer represented in an arbitrary radix.
static java.lang.String safeTrim(java.lang.String str)
           
static java.lang.String strBreak(java.lang.String longstring, int preferredWidth)
          Crude way to insert newline chars at least every N chars apart in a long string.
static java.lang.String strcat(java.lang.String one, java.lang.String two)
          Concatenates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three)
          Concatinates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three, java.lang.String four)
          Concatenates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three, java.lang.String four, java.lang.String five)
          Concatenates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three, java.lang.String four, java.lang.String five, java.lang.String six)
          Concatenates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three, java.lang.String four, java.lang.String five, java.lang.String six, java.lang.String seven)
          Concatenates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three, java.lang.String four, java.lang.String five, java.lang.String six, java.lang.String seven, java.lang.String eight)
          Concatenates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three, java.lang.String four, java.lang.String five, java.lang.String six, java.lang.String seven, java.lang.String eight, java.lang.String nine)
          Concatenates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three, java.lang.String four, java.lang.String five, java.lang.String six, java.lang.String seven, java.lang.String eight, java.lang.String nine, java.lang.String ten)
          Concatenates two strings together.
static java.lang.String strcat(java.lang.String one, java.lang.String two, java.lang.String three, java.lang.String four, java.lang.String five, java.lang.String six, java.lang.String seven, java.lang.String eight, java.lang.String nine, java.lang.String ten, java.lang.String eleven, java.lang.String twelve, java.lang.String thirteen, java.lang.String fourteen, java.lang.String fifteen)
          Concatenates up to 15 strings together.
static java.lang.String substringAfter(java.lang.String str, char separator)
          Returns the substring of str following the separator.
static java.lang.String substringAfter(java.lang.String str, java.lang.String separator)
          Returns the substring of str following the separator.
static java.lang.String substringAfterLast(java.lang.String str, char separator)
          Returns the substring of str following the last occurrence of separator.
static java.lang.String substringAfterLast(java.lang.String str, java.lang.String separator)
          Returns the substring of str following the last occurrence of separator.
static java.lang.String substringBefore(java.lang.String str, char separator)
          Returns the substring of str before the separator.
static java.lang.String substringBefore(java.lang.String str, java.lang.String separator)
          Returns the substring of str before the separator.
static java.lang.String substringBeforeLast(java.lang.String str, char separator)
          Returns the substring of str before the last occurrence of separator.
static java.lang.String substringBeforeLast(java.lang.String str, java.lang.String separator)
          Returns the substring of str before the separator.
static java.lang.String switchFirstChar(java.lang.String s, java.lang.String sub)
          Returns the passed in String as a new String with the first char replaced with the substitute String.
static java.lang.String[] tokenize(java.lang.String source, java.lang.String delims, boolean returnDelims)
          tokenizes a String and returns the array of tokens.
static java.util.List tokenizeToList(java.lang.String source, java.lang.String delims, boolean returnDelims)
          tokenizes a String and returns a List of tokens.
static java.util.Set tokenizeToSet(java.lang.String source, java.lang.String delims, boolean returnDelims)
          tokenizes a String and returns a Set of tokens.
static java.lang.String ucFirstChar(java.lang.String s)
          Returns the passed in String as a new String with the first char converted to upper case.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newline

public static final java.lang.String newline
Constructor Detail

StringUtil

public StringUtil()
Method Detail

buildDelimitedString

public static java.lang.String buildDelimitedString(java.util.List items,
                                                    char delimiter)
Builds a delimited String from the specified list of objects.

Parameters:
items - The list of items to build the string from.
delimiter - The delimiter used to the list items
Returns:
A String representation of the list items separated by the specified delimiter.

cleanIdentifier

public static java.lang.String cleanIdentifier(java.lang.String id)
Convert arbitrary Unicode string into one consisting of only ASCII letters, numbers and underscore. This lets the ID in question be used as an HTML id/name, or as a Java/JavaScript identifier.

Parameters:
id - String
Returns:
String version of id, using only "safe" characters

contains

public static boolean contains(java.lang.String[] array,
                               java.lang.String test)
Test if a string array contains a certain string.

Parameters:
array -
test -

equals

public static boolean equals(java.lang.String string1,
                             java.lang.String string2)
Compares two string for equality. This supports one or both of the specified Strings being null.

Parameters:
string1 - String to compare
string2 - String to compare
Returns:
true if the strings are equal, else false

fixUpFilename

public static java.lang.String fixUpFilename(java.lang.String filename,
                                             java.lang.String ext)
Parameters:
filename -
ext -

getCompleteExceptionText

public static java.lang.String getCompleteExceptionText(java.lang.Throwable ex)
Make an error string from an exception, including the stack trace

Parameters:
ex - Exception
Returns:
an error string from an exception, including the stack trace

getSafeXMLName

public static java.lang.String getSafeXMLName(java.lang.String oldValue)
Create a name that's safe to be used as the name of an XML element. The general algorithm trims the given value and turns any unsafe characters into underscores.

Parameters:
oldValue - The value to be used as the basis of the safe XML element name.
Returns:
A safe XML name or null if the given value was null or contained only whitespace.

getSafeXMLName

public static java.lang.String getSafeXMLName(java.lang.String oldValue,
                                              boolean allowDot)
Create a name that's safe to be used as the name of an XML element. The general algorithm trims the given value and turns any unsafe characters into underscores.

Parameters:
oldValue - The value to be used as the basis of the safe XML element name.
allowDot - if true, then the dot character is also considered to be a safe character
Returns:
A safe XML name or null if the given value was null or contained only whitespace.

getStackTraceAsString

public static java.lang.String getStackTraceAsString(java.lang.Throwable ex)
Get the stack trace from an exception

Parameters:
ex - Exception
Returns:
the stack trace, as a string.

isEmpty

public static boolean isEmpty(java.lang.String str)
Test given string argument to see if it represents an empty string.

Parameters:
str - string to test
Returns:
true if given argument is an empty string or false otherwise.

isJavaIdentifier

public static boolean isJavaIdentifier(java.lang.String s)

lcFirstChar

public static java.lang.String lcFirstChar(java.lang.String s)
Returns the passed in String as a new String with the first char converted to lower case.

Parameters:
s - the String to be modified
Returns:
String s with the first char in lowerCase

main

public static void main(java.lang.String[] args)

ncrDecode

public static java.lang.String ncrDecode(java.lang.String s)
                                  throws java.lang.NumberFormatException
Decode all numeric character references (NCR) in a string. An NCR has the format "&#;" or "&#x;".

Parameters:
s - String to be decoded.
Returns:
A string with all the NCRs decoded to explicit characters.
Throws:
java.lang.NumberFormatException - when there is an NCR in the string that cannot be successfully convertred into a plain old Java character.

ncrEncode

public static java.lang.String ncrEncode(java.lang.String s,
                                         int lowerInclusive,
                                         int upperInclusive)
Encode out-of-range characters in a string as numeric character references (NCR). An NCR has the format "&#;" or "&#x;".

Parameters:
s - String to be encoded.
lowerInclusive - The lowest character that will not be encoded.
upperInclusive - The highest character that will not not be encoded.
Returns:
A string with all out-of-range characters encoded as hex NCRs.
Throws:
java.lang.IllegalArgumentException - when upperInclusive is less than lowerInclusive.

normalize

public static java.lang.String normalize(java.lang.String value)
Normalize a string to be null if it only contains whitespace or is an empty string. Otherwise trim the content of whitespace at each end.

Parameters:
value - The string to be normalized.
Returns:
null if the parameter is null or only contains whitespace. Otherwise a trimmed version of the parameter is returned.

parseDelimitedList

public static java.util.List parseDelimitedList(java.lang.String delimitedList)
This method parses a comma delimited list into List object. It also offers an override as to what the delimiter is, by putting it as the first character of the list. Any of these characters can be the delimiter: ,.;:|~!#@#$%^&*

Parameters:
delimitedList - The comma delimited list to parse.

printf

public static java.lang.String printf(java.lang.String formatString,
                                      java.lang.Object value)
A shortcut for using the MessageFormat class, where all the arguments are strings

Parameters:
formatString - MessageFormat formatter string, where replacement points look like {#}
value - replaces {0} in format string
Returns:
formatted result

printf

public static java.lang.String printf(java.lang.String formatString,
                                      java.lang.Object value0,
                                      java.lang.Object value1)
A shortcut for using the MessageFormat class, where all the arguments are strings

Parameters:
formatString - MessageFormat formatter string, where replacement points look like {#}
value0 - replaces {0} in format string
value1 - replaces {1} in format string
Returns:
formatted result

printf

public static java.lang.String printf(java.lang.String formatString,
                                      java.lang.Object value0,
                                      java.lang.Object value1,
                                      java.lang.Object value2)
A shortcut for using the MessageFormat class, where all the arguments are strings

Parameters:
formatString - MessageFormat formatter string, where replacement points look like {#}
value0 - replaces {0} in format string
value1 - replaces {1} in format string
value2 - replaces {2} in format string
Returns:
formatted result

printf

public static java.lang.String printf(java.lang.String formatString,
                                      java.lang.Object value0,
                                      java.lang.Object value1,
                                      java.lang.Object value2,
                                      java.lang.Object value3)
A shortcut for using the MessageFormat class, where all the arguments are strings

Parameters:
formatString - MessageFormat formatter string, where replacement points look like {#}
value0 - replaces {0} in format string
value1 - replaces {1} in format string
value2 - replaces {2} in format string
value3 - replaces {3} in format string
Returns:
formatted result

replace

public static java.lang.String replace(java.lang.String source,
                                       java.lang.String target,
                                       java.lang.String replacement)
Routine to effect n-ary substitution of one string for another


safeParseInt

public static int safeParseInt(java.lang.String str,
                               int defaultVal)
Safely parse a string containing an integer.

Parameters:
str - The string to parse.
defaultVal - Default value to return if the string cannot be parsed as an integer.
Returns:
The integer represented by the string or the default value.

safeParseInt

public static int safeParseInt(java.lang.String str,
                               int radix,
                               int defaultVal)
Safely parse a string containing an integer represented in an arbitrary radix.

Parameters:
str - The string to parse.
radix - The radix of the used to represent the integer.
defaultVal - Default value to return if the string cannot be parsed as an integer.
Returns:
The integer represented by the string or the default value.
See Also:
Integer.parseInt(String, int)

safeTrim

public static java.lang.String safeTrim(java.lang.String str)

strBreak

public static java.lang.String strBreak(java.lang.String longstring,
                                        int preferredWidth)
Crude way to insert newline chars at least every N chars apart in a long string. Called by the ServiceCallCoordinator when squeezing a long error message into an IDE message box.

Parameters:
longstring - the long string to be broken up
preferredWidth - the minimum desired newline separation
Returns:
the new string

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two)
Concatenates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three)
Concatinates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three,
                                      java.lang.String four)
Concatenates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
four - The fourth part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three,
                                      java.lang.String four,
                                      java.lang.String five)
Concatenates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
four - The fourth part of the resulting string. May be null.
five - The fifth part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three,
                                      java.lang.String four,
                                      java.lang.String five,
                                      java.lang.String six)
Concatenates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
four - The fourth part of the resulting string. May be null.
five - The fifth part of the resulting string. May be null.
six - The sixth part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three,
                                      java.lang.String four,
                                      java.lang.String five,
                                      java.lang.String six,
                                      java.lang.String seven)
Concatenates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
four - The fourth part of the resulting string. May be null.
five - The fifth part of the resulting string. May be null.
six - The sixth part of the resulting string. May be null.
seven - The seventh part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three,
                                      java.lang.String four,
                                      java.lang.String five,
                                      java.lang.String six,
                                      java.lang.String seven,
                                      java.lang.String eight)
Concatenates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
four - The fourth part of the resulting string. May be null.
five - The fifth part of the resulting string. May be null.
six - The sixth part of the resulting string. May be null.
seven - The seventh part of the resulting string. May be null.
eight - The eighth part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three,
                                      java.lang.String four,
                                      java.lang.String five,
                                      java.lang.String six,
                                      java.lang.String seven,
                                      java.lang.String eight,
                                      java.lang.String nine)
Concatenates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
four - The fourth part of the resulting string. May be null.
five - The fifth part of the resulting string. May be null.
six - The sixth part of the resulting string. May be null.
seven - The seventh part of the resulting string. May be null.
eight - The eighth part of the resulting string. May be null.
nine - The ninth part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three,
                                      java.lang.String four,
                                      java.lang.String five,
                                      java.lang.String six,
                                      java.lang.String seven,
                                      java.lang.String eight,
                                      java.lang.String nine,
                                      java.lang.String ten)
Concatenates two strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
four - The fourth part of the resulting string. May be null.
five - The fifth part of the resulting string. May be null.
six - The sixth part of the resulting string. May be null.
seven - The seventh part of the resulting string. May be null.
eight - The eighth part of the resulting string. May be null.
nine - The ninth part of the resulting string. May be null.
ten - The tenth part of the resulting string. May be null.
Returns:
String The resulting string.

strcat

public static java.lang.String strcat(java.lang.String one,
                                      java.lang.String two,
                                      java.lang.String three,
                                      java.lang.String four,
                                      java.lang.String five,
                                      java.lang.String six,
                                      java.lang.String seven,
                                      java.lang.String eight,
                                      java.lang.String nine,
                                      java.lang.String ten,
                                      java.lang.String eleven,
                                      java.lang.String twelve,
                                      java.lang.String thirteen,
                                      java.lang.String fourteen,
                                      java.lang.String fifteen)
Concatenates up to 15 strings together. The result is returned as a newly created string.

Parameters:
one - The first part of the resulting string. May be null.
two - The second part of the resulting string. May be null.
three - The third part of the resulting string. May be null.
four - The fourth part of the resulting string. May be null.
five - The fifth part of the resulting string. May be null.
six - The sixth part of the resulting string. May be null.
seven - The seventh part of the resulting string. May be null.
eight - The eighth part of the resulting string. May be null.
nine - The ninth part of the resulting string. May be null.
ten - The tenth part of the resulting string. May be null. ...
Returns:
String The resulting string.

substringAfter

public static java.lang.String substringAfter(java.lang.String str,
                                              char separator)
Returns the substring of str following the separator. If str is empty or null, str is returned unchanged. If separator is not found in str, an empty string is returned

Parameters:
str - the string
separator - the separator
Returns:
a substring of str following the separator

substringAfter

public static java.lang.String substringAfter(java.lang.String str,
                                              java.lang.String separator)
Returns the substring of str following the separator. If str is empty or null, str is returned unchanged. If separator is null, an empty string is returned. If separator is not found in str, an empty string is returned

Parameters:
str - the string
separator - the separator
Returns:
a substring of str following the separator

substringAfterLast

public static java.lang.String substringAfterLast(java.lang.String str,
                                                  char separator)
Returns the substring of str following the last occurrence of separator. If str is empty or null, str is returned unchanged. If separator is not found in str, an empty string is returned

Parameters:
str - the string
separator - the separator
Returns:
a substring of str following the last occurrence of separator

substringAfterLast

public static java.lang.String substringAfterLast(java.lang.String str,
                                                  java.lang.String separator)
Returns the substring of str following the last occurrence of separator. If str is empty or null, str is returned unchanged. If separator is null or empty, an empty string is returned. If separator is not found in str, an empty string is returned

Parameters:
str - the string
separator - the separator
Returns:
a substring of str following the last occurrence of separator

substringBefore

public static java.lang.String substringBefore(java.lang.String str,
                                               char separator)
Returns the substring of str before the separator. If str is empty or null, str is returned unchanged. If separator is not found in str, str is returned unchanged.

Parameters:
str - the string
separator - the separator
Returns:
a substring of str before the separator

substringBefore

public static java.lang.String substringBefore(java.lang.String str,
                                               java.lang.String separator)
Returns the substring of str before the separator. If str is empty or null or separator is null, str is returned unchanged. If separator is empty, an empty string is returned. If separator is not found in str, str is returned unchanged.

Parameters:
str - the string
separator - the separator
Returns:
a substring of str before the separator

substringBeforeLast

public static java.lang.String substringBeforeLast(java.lang.String str,
                                                   char separator)
Returns the substring of str before the last occurrence of separator. If str is empty or null, str is returned unchanged. If separator is not found in str, str is returned unchanged.

Parameters:
str - the string
separator - the separator
Returns:
a substring of str before the last occurrence of separator

substringBeforeLast

public static java.lang.String substringBeforeLast(java.lang.String str,
                                                   java.lang.String separator)
Returns the substring of str before the separator. If str is empty or null or separator is empty or null, str is returned unchanged. If separator is not found in str, str is returned unchanged.

Parameters:
str - the string
separator - the separator
Returns:
a substring of str before the separator

switchFirstChar

public static java.lang.String switchFirstChar(java.lang.String s,
                                               java.lang.String sub)
Returns the passed in String as a new String with the first char replaced with the substitute String.

Parameters:
s - the String to be modified
sub - the String to put in place of the first char of s
Returns:
String s with the first char replaced with sub

tokenize

public static java.lang.String[] tokenize(java.lang.String source,
                                          java.lang.String delims,
                                          boolean returnDelims)
tokenizes a String and returns the array of tokens. This should have been a method of StringTokenizer in the first place.

Parameters:
source - The string to split up
delims - identical to the similar argument in java.util.StringTokenizer constructor
returnDelims - identical to the similar argument in java.util.StringTokenizer constructor
Returns:
String array of all of the tokens.
See Also:
StringTokenizer

tokenizeToList

public static java.util.List tokenizeToList(java.lang.String source,
                                            java.lang.String delims,
                                            boolean returnDelims)
tokenizes a String and returns a List of tokens. This should have been a method of StringTokenizer in the first place.

Parameters:
source - The string to split up
delims - identical to the similar argument in java.util.StringTokenizer constructor
returnDelims - identical to the similar argument in java.util.StringTokenizer constructor
Returns:
List of all of the tokens.
See Also:
StringTokenizer

tokenizeToSet

public static java.util.Set tokenizeToSet(java.lang.String source,
                                          java.lang.String delims,
                                          boolean returnDelims)
tokenizes a String and returns a Set of tokens. This should have been a method of StringTokenizer in the first place.

Parameters:
source - The string to split up
delims - identical to the similar argument in java.util.StringTokenizer constructor
returnDelims - identical to the similar argument in java.util.StringTokenizer constructor
Returns:
Set containing all of the tokens, suitable for efficient "contains" calls.
See Also:
StringTokenizer

ucFirstChar

public static java.lang.String ucFirstChar(java.lang.String s)
Returns the passed in String as a new String with the first char converted to upper case.

Parameters:
s - the String to be modified
Returns:
String s with the first char in lowerCase


Copyright © 2009 IBM. All Rights Reserved.