Package org.dlese.dpc.util.strings
Class StringUtil
java.lang.Object
org.dlese.dpc.util.strings.StringUtil
String utility class that provides sub-string replacement and quoted string
escaping
- Author:
- Ryan Deardorff
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringescapeQuotes(String str) Escape any single or double quotes within a string (usefull for strings that will be placed inside HTML inputs)static StringescapeQuotesSQL(String str) SQL strings use ' as delimeter, so inner quotes must be converted to ''static StringGiven an input string, replace all occurences of a string sequence with a given replacement string.
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
escapeQuotes
Escape any single or double quotes within a string (usefull for strings that will be placed inside HTML inputs)- Parameters:
str-
-
escapeQuotesSQL
SQL strings use ' as delimeter, so inner quotes must be converted to ''- Parameters:
str-
-
replace
Given an input string, replace all occurences of a string sequence with a given replacement string.- Parameters:
in- input stringfind- string sequence match againstreplace- string to replace matches withcaseInsensitive- should matching be case insensitive?- Returns:
- the newly altered string
-