Class Strings


  • public class Strings
    extends java.lang.Object
    A class for static String utility methods.
    • 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
      • patternIsInitialized

        private static volatile boolean patternIsInitialized
      • unescapeInitLockObject

        private static final java.lang.Object unescapeInitLockObject
    • Constructor Detail

      • Strings

        public Strings()
    • Method Detail

      • 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.
        See Also:
        Extensible Markup Language (XML) 1.0 (Fifth Edition)
      • 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)