DLESE Tools
v1.6.0

org.dlese.dpc.util.strings
Class StringUtil

java.lang.Object
  extended by org.dlese.dpc.util.strings.StringUtil

public final class StringUtil
extends Object

String utility class that provides sub-string replacement and quoted string escaping

Author:
Ryan Deardorff

Constructor Summary
StringUtil()
           
 
Method Summary
static String escapeQuotes(String str)
          Escape any single or double quotes within a string (usefull for strings that will be placed inside HTML inputs)
static String escapeQuotesSQL(String str)
          SQL strings use ' as delimeter, so inner quotes must be converted to ''
static String replace(String in, String find, String replace, boolean caseInsensitive)
          Given an input string, replace all occurences of a string sequence with a given replacement 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

escapeQuotes

public static String escapeQuotes(String str)
Escape any single or double quotes within a string (usefull for strings that will be placed inside HTML inputs)

Parameters:
str -

escapeQuotesSQL

public static String escapeQuotesSQL(String str)
SQL strings use ' as delimeter, so inner quotes must be converted to ''

Parameters:
str -

replace

public static String replace(String in,
                             String find,
                             String replace,
                             boolean caseInsensitive)
Given an input string, replace all occurences of a string sequence with a given replacement string.

Parameters:
in - input string
find - string sequence match against
replace - string to replace matches with
caseInsensitive - should matching be case insensitive?
Returns:
the newly altered string

DLESE Tools
v1.6.0