Package edu.umd.cs.findbugs.util
Class Strings
- java.lang.Object
-
- edu.umd.cs.findbugs.util.Strings
-
public class Strings extends java.lang.ObjectA class for static String utility methods.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.ObjectescapeInitLockObjectprivate static booleanpaternIsInitializedprivate static java.lang.ObjectunescapeInitLockObjectprivate static java.util.regex.PatternunescapePatternprivate static java.lang.StringunicodeUnescapeMatchExpressionprivate static intXML_ALLOWED_LOW_CHARACTER_BOUNDprivate static java.lang.String[]xmlLowValueEscapeStringsprivate static booleanxmlLowValueEscapeStringsInitialized
-
Constructor Summary
Constructors Constructor Description Strings()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.StringescapeLFCRBackSlash(java.lang.String s)static java.lang.StringescapeXml(java.lang.String s)Escape XML entities and illegal characters in the given string.static voidinitializeEscapeMap()Initializes the map of characters to be escaped and their corresponding escape sequences.static booleaninitializeUnescapePattern()Initialize regular expressions used in unescaping.private static booleanisInvalidXMLCharacter(int c)static java.lang.Stringreplace(java.lang.String source, java.lang.String find, java.lang.String repl)Deprecated.static java.lang.StringtoString(java.lang.Object[] a)Deprecated.static java.lang.StringtrimComma(java.lang.String s)Trim trailing comma from given string.static java.lang.StringunescapeXml(java.lang.String s)Unescape XML entities and illegal characters in the given string.
-
-
-
Field Detail
-
XML_ALLOWED_LOW_CHARACTER_BOUND
private static final int XML_ALLOWED_LOW_CHARACTER_BOUND
- See Also:
- Constant Field Values
-
xmlLowValueEscapeStringsInitialized
private static volatile boolean xmlLowValueEscapeStringsInitialized
-
xmlLowValueEscapeStrings
private static final java.lang.String[] xmlLowValueEscapeStrings
-
escapeInitLockObject
private static final java.lang.Object escapeInitLockObject
-
unicodeUnescapeMatchExpression
private static final java.lang.String unicodeUnescapeMatchExpression
- See Also:
- Constant Field Values
-
unescapePattern
private static java.util.regex.Pattern unescapePattern
-
paternIsInitialized
private static volatile boolean paternIsInitialized
-
unescapeInitLockObject
private static final java.lang.Object unescapeInitLockObject
-
-
Method Detail
-
replace
@Deprecated public static java.lang.String replace(java.lang.String source, java.lang.String find, java.lang.String repl)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:
java.lang.NullPointerException- if any of the arguments are nulljava.lang.IllegalArgumentException- iffindhas zero length- See Also:
String.replace(CharSequence target, CharSequence replacement)
-
toString
@Deprecated public static java.lang.String toString(java.lang.Object[] a)
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.- See Also:
String.valueOf(Object),Arrays.toString(Object[]),Arrays.deepToString(Object[])
-
trimComma
public static java.lang.String trimComma(java.lang.String s)
Trim trailing comma from given string.- Parameters:
s- a string- Returns:
- the same string with trailing comma trimmed (if any)
-
isInvalidXMLCharacter
private static boolean isInvalidXMLCharacter(int c)
-
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
public static java.lang.String escapeXml(java.lang.String s)
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:
- Extensible Markup Language (XML) 1.0 (Fifth Edition), org.apache.commons.lang.StringEscapeUtils javadoc
-
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
public static java.lang.String unescapeXml(java.lang.String s)
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:
- Extensible Markup Language (XML) 1.0 (Fifth Edition), org.apache.commons.lang.StringEscapeUtils javadoc
-
escapeLFCRBackSlash
public static java.lang.String escapeLFCRBackSlash(java.lang.String s)
-
-