Print a string in single and double Quotes in VB.NET

n this article we will learn how to print a string in single and double Quotes in VB.NET.
  • 4159

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.

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.