Printing double quotes in ASP

In ASP VBScript we can't print a double quote inside at output statement. We have to take special care to display a double quote inside or outside a string.

(In PHP we can easily escape the double quote by using escape character ( like \" ) ).

Here are some examples to display double quotes in ASP

We can use chr(34) to print a double quote to the screen

Response.Write chr(34)

( Try different values of chr to display different characters to the screen )

We can use " to print double quotes to the screen

Response.Write """

Some time within a string we will have double quotes to print. Here to print one double quote we will escape it by one more double quote so two double quotes are to be used. Read this line.

Response.Write "Raju told ""ASP is a better scripting language"""

The above line will print

Raju told "ASP is a better scripting language"

Mark the use of two double quotes within the string to display single double quotes.

Some time we have to display some variable or strings with double quotes within a table cell. Here is a code to display session id inside a table cell.

Response.Write "<tr><td>session(""userid"")</td><td>"

The output of the above is

session("userid")

Be the first to post comment on this article :





Post your comments , suggestion , error , requirements etc here .




HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer