Here you can find the source of quote(String s)
static String quote(String s)
//package com.java2s; /*//w w w. j a va 2s .com * Utilities.java * * Created on February 13, 2007, 8:18 AM * * (c) 2009 The Echo Nest * See "license.txt" for terms * */ public class Main { /** * returns a quoted version of s with all internal quotes escaped */ static String quote(String s) { String escaped = s.replaceAll("\\\"", "\\\\\""); return "\"" + escaped + "\""; } }