ARTICLE

How to print a string in single and double Quotes in VB.NET

Posted by Rohatash Kumar Articles | Strings, Arrays in VB.NET January 31, 2011
In this article we will learn how to print a string in single and double Quotes in VB.NET.
 
Reader Level:

In this article we will learn how to print a string in single Quotation and double Quotation Mark in VB.NET.

Print a string with single Quotation mark

Suppose we want to print a string variable in single quotes.

example

('Hello Rohatash Kumar')

Code to print single Quotation with string in Visual Basic.

Dim strSingleQuote As String

 strSingleQuote = "'Hello Rohatash Kumar'"

  Console.WriteLine("This code defines the single quotation mark =" & strSingleQuote)

 

Print a string with double Quotation mark

Suppose we want to print a string variable in double quotes.

Example

(Hi ''I am fine'' Monu)

Code to print double Quotation with string in Visual Basic.

Dim strdoubleQuote As String

 strdoubleQuote = "Hi ''I am fine'' Monu"

  Console.WriteLine("This defines the double Quotation mark=" & strdoubleQuote)


Code to print double Quotation with string in Visual Basic.

Dim strdoubleQuote As String

 strdoubleQuote = "Hi ''I am fine'' Monu"

  Console.WriteLine("This defines the double Quotation mark=" & strdoubleQuote)

 

The below program prints the string in single and double quotes.

Module Module1

    Sub Main()

        Dim strSingleQuote As String

        strSingleQuote = "'Hello Rohatash Kumar'"

        Console.WriteLine("This code defines the single quotation mark =" & strSingleQuote)

         Dim strdoubleQuote As String

        strdoubleQuote = "Hi ''I am fine'' Monu"

        Console.WriteLine("This defines the double Quotation mark=" & strdoubleQuote)

    End Sub

End Module

 

Output


s1.gif

Figure 1.

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor