gpt4 book ai didi

javascript - 替换函数内的 Espace 单/双引号

转载 作者:行者123 更新时间:2023-12-02 18:56:57 26 4
gpt4 key购买 nike

我正在尝试从转义字符字符串中删除单引号和双引号。它对单引号 ' 或双自动 " 不起作用。

请问有人可以帮忙吗?

var mysting = escapedStr.replace(/^%22/g, ' '); //doesnt remove the double quotes

var mysting = escapedStr.replace(/^%27/g, ' '); //doesnt remove the single quotes

var mysting = escapedStr.replace(/^%3A/g, ' '); //does remove the SEMI COLON %3A

最佳答案

尝试这个链式代码片段:

escape(
unescape( mysting ).replace( /['"]/g, "" )
)

它很小,但应该可以完成您需要它做的事情。

关于javascript - 替换函数内的 Espace 单/双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15248125/

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