Class EscapeUtil


  • public final class EscapeUtil
    extends Object
    • Method Detail

      • javaEscape

        public static String javaEscape​(CharSequence string)
        Properly java-escape the string for including in java strings or printing with escape symbols to console.
        Parameters:
        string - The string to escape.
        Returns:
        The escaped string.
      • javaEscape

        public static String javaEscape​(char c)
        Escape a single character. It is escaped into a string, as it may become more than one char when escaped. The char is escaped in a way that can be included in a java char
        Parameters:
        c - The char to escape.
        Returns:
        The escaped char string.
      • javaUnEscape

        public static String javaUnEscape​(CharSequence str)
        UnEscape the char sequence using javas escape syntax used above and in java strings.
        Parameters:
        str - The string to un-escape.
        Returns:
        The un-escaped string.
      • javaUnEscape

        public static String javaUnEscape​(CharSequence str,
                                          boolean strict)
        UnEscape the char sequence using javas escape syntax used above and in java strings.
        Parameters:
        str - The string to un-escape.
        strict - If it should validate string content strictly.
        Returns:
        Slice decoded as UTF_8 string handling escaped characters.