如何在 c# 或 jquery 中将双引号替换为单引号?

我的字符串是 <br/>


var lookfor = "\(Dos LIKE ''" + Dos + "'' OR Practice LIKE ''" + PracticeName + "''  OR Patient LIKE ''" + PatientName + "''  OR ClaimId LIKE ''" + ClaimId + "'' OR Charges LIKE ''" + Charges + "'' OR Payment  LIKE ''" + Payment + "'' OR InsuranceStatus  LIKE ''" + Status + "'')";

但我需要一个字符串 <br/>


var lookfor = '\(Dos LIKE ''" + Dos + "'' OR Practice LIKE ''" + PracticeName + "''  OR Patient LIKE ''" + PatientName + "''  OR ClaimId LIKE ''" + ClaimId + "'' OR Charges LIKE ''" + Charges + "'' OR Payment  LIKE ''" + Payment + "'' OR InsuranceStatus  LIKE ''" + Status + "'')';

我正在尝试此代码但无法解决它


var jsonStr = lookfor.replace(/"/g, "'");

var jsonStr1= lookfor.replace(/"/g, '\'');

请帮忙....


holdtom
浏览 169回答 2
2回答

叮当猫咪

var lookfor = "\\(Dos LIKE ''" + Dos + "'' OR Practice LIKE ''" + PracticeName + "''&nbsp; OR Patient LIKE ''" + PatientName + "''&nbsp; OR ClaimId LIKE ''" + ClaimId + "'' OR Charges LIKE ''" + Charges + "'' OR Payment&nbsp; LIKE ''" + Payment + "'' OR InsuranceStatus&nbsp; LIKE ''" + Status + "'')";var newTemp = lookfor.Replace("\"", "'");这是ideone 上的演示

蛊毒传说

var jsonStr = lookfor.replace(@"""", @"\""");
打开App,查看更多内容
随时随地看视频慕课网APP