如何在 JavaScript 的数组中用 '"' 替换 "\\"
How to replace "\\" with '"' in an array in JavaScript
任何人都可以帮助我解决我的问题。
Array = [
{ y: 0.02, label: \5:37 A\ },
{ y: 0.02, label: \2:54 A\ },
{ y: 0.02, label: \1:00 A\ },
]
应将 \
替换为 "
预期 Array/String 应为
[
{ y: 0.02, label: "5:37 A" },
{ y: 0.02, label: "2:54 A" },
{ y: 0.02, label: "1:00 A" },
]
提前致谢
\+
通过"
尝试this.Seedemo.Replace
https://regex101.com/r/aI4rA5/13
var re = /\+/gm;
var str = '{ y: 0.02, label: \5:37 A\ }';
var subst = '"';
var result = str.replace(re, subst);
任何人都可以帮助我解决我的问题。
Array = [
{ y: 0.02, label: \5:37 A\ },
{ y: 0.02, label: \2:54 A\ },
{ y: 0.02, label: \1:00 A\ },
]
应将 \
替换为 "
预期 Array/String 应为
[
{ y: 0.02, label: "5:37 A" },
{ y: 0.02, label: "2:54 A" },
{ y: 0.02, label: "1:00 A" },
]
提前致谢
\+
通过"
https://regex101.com/r/aI4rA5/13
var re = /\+/gm;
var str = '{ y: 0.02, label: \5:37 A\ }';
var subst = '"';
var result = str.replace(re, subst);