Package edu.umd.cs.findbugs.util
Class Strings
java.lang.Object
edu.umd.cs.findbugs.util.Strings
A class for static String utility methods.
- Author:
- Brian Cole
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
static String
Escape XML entities and illegal characters in the given string.static void
Initializes the map of characters to be escaped and their corresponding escape sequences.static boolean
Initialize regular expressions used in unescaping.static String
Deprecated.static String
Deprecated.static String
Trim trailing comma from given string.static String
Unescape XML entities and illegal characters in the given string.
-
Constructor Details
-
Strings
public Strings()
-
-
Method Details
-
replace
Deprecated.This is intended to be semantically equivalent tosource.replace(find, repl)
but also compatible with JDK 1.4.- Parameters:
source
- The String on which to operatefind
- The literal substring to be replacedrepl
- The literal replacement substring- Returns:
- The resultant String after substitution
- Throws:
NullPointerException
- if any of the arguments are nullIllegalArgumentException
- iffind
has zero length- See Also:
-
toString
Deprecated.This is intended to be equivalent toArrays.toString(a)
but also compatible with JDK 1.4. This concatenates the results of calling String.valueOf() on each element of the array, so this won't work well for multi-dimensional arrays. -
trimComma
Trim trailing comma from given string.- Parameters:
s
- a string- Returns:
- the same string with trailing comma trimmed (if any)
-
initializeEscapeMap
public static void initializeEscapeMap()Initializes the map of characters to be escaped and their corresponding escape sequences. This method will be invoked automatically the first time a string is escaped/unescaped. -
escapeXml
Escape XML entities and illegal characters in the given string. This enhances the functionality of org.apache.commons.lang.StringEscapeUtils.escapeXml by escaping low-valued unprintable characters, which are not permitted by the W3C XML 1.0 specification.- Parameters:
s
- a string- Returns:
- the same string with characters not permitted by the XML specification escaped
- See Also:
-
initializeUnescapePattern
public static boolean initializeUnescapePattern()Initialize regular expressions used in unescaping. This method will be invoked automatically the first time a string is unescaped. -
unescapeXml
Unescape XML entities and illegal characters in the given string. This enhances the functionality of org.apache.commons.lang.StringEscapeUtils.unescapeXml by unescaping low-valued unprintable characters, which are not permitted by the W3C XML 1.0 specification.- Parameters:
s
- a string- Returns:
- the same string with XML entities/escape sequences unescaped
- See Also:
-
escapeLFCRBackSlash
-