Class Strings

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

public class Strings extends Object
A class for static String utility methods.
Author:
Brian Cole
  • Constructor Details

    • Strings

      public Strings()
  • Method Details

    • replace

      @Deprecated public static String replace(String source, String find, String repl)
      Deprecated.
      This is intended to be semantically equivalent to source.replace(find, repl) but also compatible with JDK 1.4.
      Parameters:
      source - The String on which to operate
      find - The literal substring to be replaced
      repl - The literal replacement substring
      Returns:
      The resultant String after substitution
      Throws:
      NullPointerException - if any of the arguments are null
      IllegalArgumentException - if find has zero length
      See Also:
    • toString

      @Deprecated public static String toString(Object[] a)
      Deprecated.
      This is intended to be equivalent to Arrays.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:
    • 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)
    • 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)