org.jlog2.util
Class StringHandler

java.lang.Object
  extended by org.jlog2.util.StringHandler

public class StringHandler
extends java.lang.Object

This class provides additional String processing functionality over what the CDC Java package 1.0 provides.


Constructor Summary
StringHandler()
           
 
Method Summary
static boolean contains(java.lang.String s1, java.lang.String s2)
          Return true if the String s1 contains the String s2.
static boolean containsIgnoreCase(java.lang.String s1, java.lang.String s2)
          Return true if the String s1 contains the String s2 ignoring case.
static java.lang.String replaceAll(java.lang.String s1, java.lang.String s2, java.lang.String replace)
          Replace all occurrences of s2 in s1 with the replacement text.
static java.lang.String replaceAllIgnoreCase(java.lang.String s1, java.lang.String s2, java.lang.String replace)
          Replace all occurrences of s2 in s1 with the replacement text.
static java.lang.String replaceFirst(java.lang.String s1, java.lang.String s2, java.lang.String replace)
          Replace the first occurrence of s2 in s1 with the replacement text.
static java.lang.String replaceFirstIgnoreCase(java.lang.String s1, java.lang.String s2, java.lang.String replace)
          Replace the first occurrence of s2 in s1 with the replacement text.
static java.util.Vector tokenize(java.lang.String s1, java.lang.String separator, boolean includeSeparator)
          Tokenize the string based on the separator and return the tokens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringHandler

public StringHandler()
Method Detail

contains

public static boolean contains(java.lang.String s1,
                               java.lang.String s2)
Return true if the String s1 contains the String s2.

Parameters:
s1 - the first String.
s2 - the second String.
Returns:
true if s1 contains s2 as part of its sequence of characters.

containsIgnoreCase

public static boolean containsIgnoreCase(java.lang.String s1,
                                         java.lang.String s2)
Return true if the String s1 contains the String s2 ignoring case.

Parameters:
s1 - the first String.
s2 - the second String.
Returns:
true if s1 contains s2 as part of its sequence of characters.

replaceFirst

public static java.lang.String replaceFirst(java.lang.String s1,
                                            java.lang.String s2,
                                            java.lang.String replace)
Replace the first occurrence of s2 in s1 with the replacement text.

Parameters:
s1 - the String to change.
s2 - the text to remove.
replace - the text to replace s2 with.
Returns:
the s1 String with the first occurrence of s2 replaced with replace.

replaceFirstIgnoreCase

public static java.lang.String replaceFirstIgnoreCase(java.lang.String s1,
                                                      java.lang.String s2,
                                                      java.lang.String replace)
Replace the first occurrence of s2 in s1 with the replacement text. Ignore the case of s2 in s1, but add replace as is.

Parameters:
s1 - the String to change.
s2 - the text to remove.
replace - the text to replace s2 with.
Returns:
the s1 String with the first occurrence of s2 replaced with replace.

replaceAll

public static java.lang.String replaceAll(java.lang.String s1,
                                          java.lang.String s2,
                                          java.lang.String replace)
Replace all occurrences of s2 in s1 with the replacement text.

Parameters:
s1 - the String to change.
s2 - the text to remove.
replace - the text to replace s2 with.
Returns:
the s1 String with all occurrences of s2 replaced with replace.

replaceAllIgnoreCase

public static java.lang.String replaceAllIgnoreCase(java.lang.String s1,
                                                    java.lang.String s2,
                                                    java.lang.String replace)
Replace all occurrences of s2 in s1 with the replacement text. Ignore the case of s2 in s1, but add replace as is.

Parameters:
s1 - the String to change.
s2 - the text to remove.
replace - the text to replace s2 with.
Returns:
the s1 String with all occurrences of s2 replaced with replace.

tokenize

public static java.util.Vector tokenize(java.lang.String s1,
                                        java.lang.String separator,
                                        boolean includeSeparator)
Tokenize the string based on the separator and return the tokens.

Parameters:
s1 - the string to tokenize.
separator - the character sequence to separate tokens.
includeSeparator - if true include separator string as tokens.
Returns:
the list of strings tokenized by the separator.