Replace string in C#

Replace string in C#

How to Replace " (double quotes) in C# Sharp string? | Remove " (double quotes) in C# string? | Strip Double Quotes from String | Replace double quotes in c# string | Replace double quotes in c sharp string

I have a string in C Sharp whose content when displayed looks like below

            This is my text with some double "quotes"  

My objective is to Remove the double quotes in C# string and replace them with empty string. 

This can be achieve using below 2 ways

Example 1

C# code

string myStringWithQuotes = @"This is my text with some double ""quotes""";

Response.Write( myStringWithQuotes.Replace(@"""", string.Empty) );

 

Example 2
C# code 

string myStringWithQuotes = @"This is my text with some double ""quotes""";

Response.Write( myStringWithQuotes.Replace("\"", string.Empty) );

 

Output in both cases -->   This is my text with some double quotes  

 So hope this helps you all. Happy Coding :)


Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5