简体   繁体   中英

How to replace double quotes to single quotes in c# or jquery?

My string is <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 + "'')";

but i required a string <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 + "'')';

I am try this code but cannot resolved it

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

please help....

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 newTemp = lookfor.Replace("\"", "'");

Here is a demo on ideone

var jsonStr = lookfor.replace(@“”“”,@“ \\”“”);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM