gpt4 book ai didi

javascript - 删除javascript中的反斜杠

转载 作者:行者123 更新时间:2023-11-30 16:37:25 25 4
gpt4 key购买 nike

我有一个字符串,我想删除所有反斜杠。

$str = esktop rch for \\\\\\\\\\\\\'lorem ipsum\\\\\\\\\\\\' will uncover many web sites still in their infancy. Various versions have evolv.

在 PHP 中

preg_replace('/\\\\/', '', $str ); is working.

如何在 javascript 中做同样的事情???

最佳答案

这是一个例子:

var someString = 'sktop rch for \\\\\\\\\\\\\lorem ipsum\\\\\\\\\\\\ will uncover many web sites still in their infancy. Various versions have evolv';
var anotherString = someString.replace(/\\/g, '');
document.write(anotherString);

关于javascript - 删除javascript中的反斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32516228/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com