Package datahub.event

Class StringEscapeUtils


  • public class StringEscapeUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String escapeJava​(java.lang.String str)
      Escapes the characters in a String using Java String rules.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • escapeJava

        public static java.lang.String escapeJava​(java.lang.String str)
                                           throws java.io.IOException
        Escapes the characters in a String using Java String rules.

        Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)

        So a tab becomes the characters '\\' and 't'.

        The only difference between Java strings and JavaScript strings is that in JavaScript, a single quote must be escaped.

        Example:

         input string: He didn't say, "Stop!"
         output string: He didn't say, \"Stop!\"
         
        Parameters:
        str - String to escape values in, may be null
        Returns:
        String with escaped values, null if null string input
        Throws:
        java.io.IOException