Emits a quoted string value, escaping characters that are required to be escaped.
760117
private void emitStringValue(String s) {
    raw('"');
    char b = 0, c = 0;
    for (int i = 0; i < s.length(); i++) {
      b = c;
      c = s.charAt(i);

      switch (c) {
        case '\\':
        case '"':
          raw('\\');
          raw(c);
          break;
        case '/':
          // Special case to ensure that </script> doesn't appear in JSON
          // output
          if (b == '<')
            raw('\\');
          raw(c);
          break;
        case '\b':
          raw("\\b");
          break;
        case '\t':
          raw("\\t");
          break;
        case '\n':
          raw("\\n");
          break;
        case '\f':
          raw("\\f");
          break;
        case '\r':
          raw("\\r");
          break;
        default:
          if (shouldBeEscaped(c)) {
            String t = "000" + Integer.toHexString(c);
            raw("\\u" + t.substring(t.length() - "0000".length()));
          } else {
            raw(c);
          }
      }
    }

    raw('"');
  }
1361466
private static StringBuilder escapeRegex(final StringBuilder regex, final String value, final boolean unquote) {
        regex.append("\\Q");
        for (int i = 0; i < value.length(); ++i) {
            char c = value.charAt(i);
            switch (c) {
                case '\'':
                    if (unquote) {
                        if (++i == value.length()) {
                            return regex;
                        }
                        c = value.charAt(i);
                    }
                    break;
                case '\\':
                    if (++i == value.length()) {
                        break;
                    }

                    regex.append(c); // we always want the original \
                    c = value.charAt(i); // Is it followed by E ?
                    if (c == 'E') { // \E detected
                        regex.append("E\\\\E\\"); // see comment above
                        c = 'Q'; // appended below
                    }
                    break;
                default:
                    break;
            }
            regex.append(c);
        }
        regex.append("\\E");
        return regex;
    }
1028919
def _escape_str(value):
        

        if isinstance(value, int):
            return "%d" % value
        value = value.replace("\\", r'\\')
        for i, j in ts3_escape.items():
            value = value.replace(i, j)
        return value
188124
private String escapeString(String value)
   {
      m_buffer.setLength(0);
      m_buffer.append('"');
      for (int index = 0; index < value.length(); index++)
      {
         char c = value.charAt(index);
         switch (c)
         {
            case '"':
            {
               m_buffer.append("\\\"");
               break;
            }

            case '\\':
            {
               m_buffer.append("\\\\");
               break;
            }

            case '/':
            {
               m_buffer.append("\\/");
               break;
            }

            case '\b':
            {
               m_buffer.append("\\b");
               break;
            }

            case '\f':
            {
               m_buffer.append("\\f");
               break;
            }

            case '\n':
            {
               m_buffer.append("\\n");
               break;
            }

            case '\r':
            {
               m_buffer.append("\\r");
               break;
            }

            case '\t':
            {
               m_buffer.append("\\t");
               break;
            }

            default:
            {
               // Append if it's not a control character (0x00 to 0x1f)
               if (c > 0x1f)
               {
                  m_buffer.append(c);
               }
               break;
            }
         }
      }
      m_buffer.append('"');
      return m_buffer.toString();
   }
211472
public static String escape(final String value) {
        final StringBuilder builder = new StringBuilder();
        for (final char ch : value.toCharArray()) {
            builder.append(ESCAPES.containsKey(ch) ? ESCAPES.get(ch) : ch);
        }
        return builder.toString();
    }
347250
public static void quote(StringBuffer buf, String s)
    {
        synchronized(buf)
        {
            buf.append('"');
            for (int i=0;i<s.length();i++)
            {
                char c = s.charAt(i);
                if (c=='"')
                {   
                    buf.append("\\\"");
                    continue;
                }
                if (c=='\\')
                {   
                    buf.append("\\\\");
                    continue;
                }
                buf.append(c);
                continue;
            }
            buf.append('"');
        }
    }
1097758
public static String escape(String value) {
        for (int i = 0; i < value.length(); i++) {
            if (isEscapingChar(value.charAt(i))) {
                return doEscape(value.getBytes(StandardCharsets.UTF_8), i);
            }
        }
        return value;
    }
602585
def escape(string)
      return "" unless string
      str = string.b
      str.gsub!(/&/n, '&amp;')
      str.gsub!(/\"/n, '&quot;')
      str.gsub!(/>/n, '&gt;')
      str.gsub!(/</n, '&lt;')
      str.force_encoding(string.encoding)
    end
709789
private static final String escape(String str) {
        if (str == null) {
            return null;
        }

        StringBuilder sb = new StringBuilder(str.length() * 2);
        int len = str.length();
        for (int i = 0; i < len; i++) {
            char c = str.charAt(i);
            switch (c) {
                case TOKEN_DELIM:
                case USER_DATA_DELIM:
                case USER_ATTRIB_DELIM:
                    sb.append('\\');
                    break;
                default:
                    break;
            }
            sb.append(c);
        }
        return sb.toString();
    }
1264691
function escape(value) {
  return value
    .split('')
    .map(function(character) {
      return '\\u' + character.charCodeAt(0).toString(16)
    })
    .join('')
}
246924
public static void maybeQuote(StringBuilder buf, String value) {
        if (value==null || value.length()==0) {
            buf.append("\"\"");
        } else if (alreadyQuoted(value)) {
            buf.append('"');
            buf.append(escapeDoubleQuotes(value,1,value.length()-1));
            buf.append('"');
        } else if ((isHttpToken(value) && !ALLOW_HTTP_SEPARATORS_IN_V0) ||
                (isV0Token(value) && ALLOW_HTTP_SEPARATORS_IN_V0)) {
            buf.append('"');
            buf.append(escapeDoubleQuotes(value,0,value.length()));
            buf.append('"');
        } else {
            buf.append(value);
        }
    }
813924
def translate_escaped_str(cls, str_val):
        """"""
        if isinstance(str_val, string_types):
            str_val = str_val.encode('unicode_escape')
            if sys.version_info >= (3, 0):
                str_val = str_val.decode('utf-8')
            str_val = str_val.replace('"', r'\"')
        return '"{}"'.format(str_val)
1148007
def quote_header_value(value, extra_chars='', allow_token=True):
    
    value = to_string(value)
    if allow_token:
        token_chars = HEADER_TOKEN_CHARS | set(extra_chars)
        if set(value).issubset(token_chars):
            return value
    return '"%s"' % value.replace('\\', '\\\\').replace('"', '\\"')
831
def escape(self, text, quote = True):
        
        if isinstance(text, bytes):
            return escape_b(text, quote)
        else:
            return escape(text, quote)
292279
String escapeValue(Object value) {
        return HtmlUtils.htmlEscape(value != null ? value.toString() : "<null>");
    }
564033
function escape (string) {
  return string
    .replace(/ /g, '\\ ')
    .replace(/\n/g, '')
    .replace(/\(/g, '\\(')
    .replace(/\)/g, '\\)');
}
869553
public static void quote(StringBuilder buf, String str) {
        buf.append('"');
        escape(buf, str);
        buf.append('"');
    }