use*_*091 9 javascript slash web-scraping
如何删除JavaScript字符串中的所有反斜杠?
var str = "one thing\\\'s for certain: power blackouts and surges can damage your equipment.";
Run Code Online (Sandbox Code Playgroud)
我希望输出像
one thing's for certain: power blackouts and surges can damage your equipment.
Run Code Online (Sandbox Code Playgroud)
更新:
我在JavaScript的帮助下从页面中删除数据并在fancy-box弹出窗口中显示.
请帮帮我
Aru*_*hny 40
使用简单的正则表达式来解决它
str = str.replace(/\\/g, '')
Run Code Online (Sandbox Code Playgroud)
演示:小提琴
这是根据标题的答案,因为标题是" 删除Javascript中的所有斜杠 " 而不是反斜杠.所以这里是从JavaScript中删除字符串中的所有斜杠的代码.
str = '/mobiles-phones/.png';
str.replace(/\//g, "")//output would be "mobiles-phones.png";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
40577 次 |
| 最近记录: |