如何删除JavaScript字符串中的所有反斜杠?
var str = "one thing\\\'s for certain: power blackouts and surges can damage your equipment.";
我想输出
one thing's for certain: power blackouts and surges can damage your equipment.
更新
我在JavaScript&帮助下从页面中删除数据在fancy-box popup上显示。
请帮我这个
答案 0 :(得分:35)
答案 1 :(得分:6)
这是根据标题的答案,因为标题是“删除Javascript中的所有斜杠”而不是反斜杠。所以这里是从JavaScript中删除字符串中所有斜杠的代码。
str = '/mobiles-phones/.png';
str.replace(/\//g, "")//output would be "mobiles-phones.png";
答案 2 :(得分:0)
How do I do string replace in JavaScript to convert ‘9.61’ to ‘9:61’?
var str = "one thing\\\'s for certain: power blackouts and surges can damage your equipment.";
str.replace("\", "");
答案 3 :(得分:0)
正则表达式非常棒str.replace(/\\/g,'')