使用javascript删除字符串的双引号内的双引号。
我正在从CSV文件中接收到带有双引号的字符串。
实际输入的字符串为"my testing is "Done"";
读取CSV文件后,我得到了以下字符串,
var test = "my testing is ""Done""";
我想使用javascript获取输出:my testing is "Done"
。
预期输出:my testing is "Done"
实际输出:Main end Bus support location is \""A""
答案 0 :(得分:3)
您可以将所有""
替换为一个"
var test = 'my testing is ""Done""',
output = test.replace(/"+/g, '"');
console.log(output)
答案 1 :(得分:0)
<html>
<body onload="call()">
</body>
<script>
function call(){
var ss = 'my testing is ""Done""';
ss = ss.replace('""Done""',"\"Done\"");
}
</script>
</html>