Yahoo Search

Search the web Search this site

Live Search

Google Search

Custom Search

Translate this Web Site to

Friday, January 04, 2008

Inserting a Double Quote in to a String in .NET

Even though this is not new I do forget this always, so thought of putting an entry on how we can put a double quote inside of a string.

Dim str As String = "Example String " & """" & "This is the String with double quotes." & """"

In VB.Net you can indicate that there is a double quote in a string by using 4 double quotes ("""").

string str = "Example String " + "\"" + "This is the String with double quotes." + "\"";

As you will notice in C# the double quote can be represented as double quote, back slash and again using two double quotes ("\"").

The above string will be displayed as follows.

Post a Comment