aaa333:js 单引号替换成双引号,双引号替换成单引号 操作 2024-04-04 09:01:42 0 0 1.双引号替换成单引号 [javascript] view plain copyvar _adrobj = JSON.stringify(address).replace(/\"/g,"'"); ps:[javascript] view plain copyvar a = {a:1,b:2}; JSON.stringify(a)====>"{"a":1,"b":2}" 2.单引号替换成双引号 [javascript] view plain copyvar _nstr = _adrdata.replace(/'/g, '"'); ps: [javascript] view plain copyvar json = JSON.parse(_nstr); if (json.storeDelivery == 0) { msgBox($.msg.OutDistributeAddress); return; } [javascript] view plain copyfunction escapeHTML(a) { return a.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/ /g, " ").replace(/"/g, """).replace(/'/g, "'") } 收藏(0)