Class Strings

java.lang.Object
edu.umd.cs.findbugs.util.Strings

public class Strings extends Object
A class for static String utility methods.
  • Field Details

    • XML_ALLOWED_LOW_CHARACTER_BOUND

      private static final int XML_ALLOWED_LOW_CHARACTER_BOUND
      See Also:
    • xmlLowValueEscapeStringsInitialized

      private static volatile boolean xmlLowValueEscapeStringsInitialized
    • xmlLowValueEscapeStrings

      private static final String[] xmlLowValueEscapeStrings
    • escapeInitLockObject

      private static final Object escapeInitLockObject
    • unicodeUnescapeMatchExpression

      private static final String unicodeUnescapeMatchExpression
      See Also:
    • unescapePattern

      private static Pattern unescapePattern
    • patternIsInitialized

      private static volatile boolean patternIsInitialized
    • unescapeInitLockObject

      private static final Object unescapeInitLockObject
  • Constructor Details

    • Strings

      public Strings()
  • Method Details

    • trimComma

      public static String trimComma(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.
      See Also:
    • escapeXml

      public static String escapeXml(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:
    • 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 String unescapeXml(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:
    • escapeLFCRBackSlash

      public static String escapeLFCRBackSlash(String s)