com.tinnef.util
Class StringUtilities

java.lang.Object
  |
  +--com.tinnef.util.StringUtilities

public class StringUtilities
extends java.lang.Object

This class contains a number of static methods that are useful for manipulating Strings.


Constructor Summary
StringUtilities()
           
 
Method Summary
static java.lang.String asURL(java.lang.String s)
          Return a String for use in an URL.
static java.lang.String escapeDoubleQuotesAndSlashes(java.lang.String s)
          Escape " or \ characters with \ in string S.
static int occurencesOf(java.lang.String target, java.lang.String searchString)
          Return the number of occurences of searchString in target
static java.lang.String removeChars(java.lang.String target, java.lang.String characters)
          Return a new string that is the result of removing every character in the string characters from the target string
static java.lang.String replace(java.lang.String target, java.lang.String searchString, java.lang.String replaceString)
          Create and return a new String by replacing searchString with replaceString in target
static java.lang.String sentenceCaps(java.lang.String s)
          Return a new String with the first word in every sentence capitalized.
static java.lang.String wordCaps(java.lang.String s)
          Return a new String with every word capitalized.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtilities

public StringUtilities()
Method Detail

asURL

public static java.lang.String asURL(java.lang.String s)
Return a String for use in an URL. Remove whitespace from both ends and replace contiguous whitespace with a single '+'

escapeDoubleQuotesAndSlashes

public static java.lang.String escapeDoubleQuotesAndSlashes(java.lang.String s)
Escape " or \ characters with \ in string S.

occurencesOf

public static int occurencesOf(java.lang.String target,
                               java.lang.String searchString)
Return the number of occurences of searchString in target

removeChars

public static java.lang.String removeChars(java.lang.String target,
                                           java.lang.String characters)
Return a new string that is the result of removing every character in the string characters from the target string

replace

public static java.lang.String replace(java.lang.String target,
                                       java.lang.String searchString,
                                       java.lang.String replaceString)
Create and return a new String by replacing searchString with replaceString in target

sentenceCaps

public static java.lang.String sentenceCaps(java.lang.String s)
Return a new String with the first word in every sentence capitalized.

wordCaps

public static java.lang.String wordCaps(java.lang.String s)
Return a new String with every word capitalized.