我想用单引号替换所有出现的字符串,但是str.replace
它只替换第一次出现的脚本:
"7<singleQuote>1 inche<singleQuote>s"
代码
var data = "7<singleQuote>1 inche<singleQuote>s"
var output = data.replace("<singleQuote>","'")
输出:7'1 inche<singleQuote>s
我想将<singleQuote>
替换为'
。
答案 0 :(得分:2)