Link to home
Create AccountLog in
Avatar of Dovberman
DovbermanFlag for United States of America

asked on

Substring Replace Method

The following works when replacing a single quote with a blank.

// Replace "'" with ""
        string sb = "a'bc'd";
        string sb1 = "";
        sb1 = sb.Replace("'", "");      

How do I replace a double quote with a blank?

// Replace """ with ""
        string sb = "a"bc"d";
        string sb1 = "";
        sb1 = sb.Replace(""", "");      

Thanks
Avatar of Ioannis Paraskevopoulos
Ioannis Paraskevopoulos
Flag of Greece image

Hi,

You need to escape the double quote. Use two double quotes in order to escape it.

 sb1 = sb.Replace("""", ""); 

Open in new window


Giannis
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Dovberman

ASKER

Thank you