Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 22nd, 2011, 09:39 AM
Authorized User
Join Date: Dec 2009
Posts: 85
Thanks: 16
Thanked 0 Times in 0 Posts
Default replacing the " character

Hi there

I'm wanting to replace the " character in a string as it is terminating the string value in the outputted string.

How would I go about this?

I'm trying: <%=(replace(strproductname, chr(22),""")%>

but this is the wrong syntax and I'm not sure how to do it.

Can anyone help?


Old January 22nd, 2011, 11:11 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

You can use something like this:

Dim test = "String""WithQuote"
test = Replace(test, """", "")

This replaces quotes with an empty string. Since a double quote has special meaning, you need to escape it with another double quote. Hence the four quotes, two to denote the start and end of the string and two more to represent the single instace you want to replace.

However, Server.HTMLEncode maybe mire suitable:



Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
adamhw (January 25th, 2011)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
replacing &quot; gantait XSLT 1 March 4th, 2007 10:44 AM
Replacing a character from string itHighway Classic ASP Basics 5 March 14th, 2005 11:15 PM
Replace Character &quot; fosca XSLT 1 November 11th, 2004 04:14 PM
Replacing a character with an integer sereneabraham79 VS.NET 2002/2003 2 September 18th, 2004 12:34 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.