Here's a short piece of code:
这是一段很短的代码:
var utility = {
escapeQuotes: function(string) {
return string.replace(new RegExp('"', 'g'),'\"');
},
unescapeQuotes: function(string) {
return string.replace(new RegExp('\"', 'g'),'"');
}
};
var a = 'hi "';
var b = utility.escapeQuotes(a);
var c = utility.unescapeQuotes(b);
console.log(b + ' | ' + c);
va