Class EscapeChars


  • public class EscapeChars
    extends Object
    This class provides various character escaping utility methods,
    • Constructor Detail

      • EscapeChars

        public EscapeChars()
    • Method Detail

      • forURL

        @Deprecated
        public static String forURL​(String queryString)
        Deprecated.
        Used to ensure that HTTP query strings are in proper form, by escaping special characters such as spaces. This method does form encoding.
        Parameters:
        queryString - The string that need to be escaped
        Returns:
        The escaped version of the queryString.
      • forUrl

        public static String forUrl​(String string)
        Escapes strings with URL percent encoding.
      • forFormSubmission

        public static String forFormSubmission​(String str)
        Escapes strings with application/x-www-form-urlencoded encoding.
      • forUnixShell

        @NotNull
        public static @NotNull String forUnixShell​(@NotNull
                                                   @NotNull String s)
        Escapes a command line element (argument or command name) so that it's treated as a single token if written to a script file directly.
      • forScriptTag

        @NotNull
        public static @NotNull String forScriptTag​(@NotNull
                                                   @NotNull String string)
        Escapes content so that it can be safely embedded in a <script> tag in HTML5.