cooleo100d
07-18-2005, 04:18 PM
Hi,
In ASP.NET, when you have quotes within a variable, how do you escape them?
For instance, it might look like this:
myvar = "<input type="text" name="mytext">"
I know in PHP this is so easy because you can just use a \".
Does anybody have any idea how this would be done in ASP.NET?
Thanks for your help,
~David
Brandoe85
07-18-2005, 04:26 PM
Two single quotes should work:
Response.Write("''this is a quote''")
cooleo100d
07-18-2005, 04:32 PM
Do you mean ''"'' will escape it? I tried it, and it didn't seem to work.
cooleo100d
07-18-2005, 04:52 PM
Ok I got it. It's like:
myvar = "This is ""cool"" !!!!"
Brandoe85
07-18-2005, 04:57 PM
I meant to say two double quotes my bad, if you're using c# you'll be able to use the \ sequence in occasions, but you can just go:
myvar = "<input type=""text"" name=""mytext"">"
lol glad you got it working...
cooleo100d
07-18-2005, 05:01 PM
Thanks for your help.
~David
boskom
03-19-2011, 03:15 PM
Hi,
In ASP.NET, when you have quotes (http://quotesaboutlifeandhappiness.blogspot.com/) within a variable, how do you escape them?
For instance, it might look like this:
myvar = "<input type="text" name="mytext">"
I know in PHP this is so easy because you can just use a \".
Does anybody have any idea how this would be done in ASP.NET?
Thanks for your help,
~David
I know maybe this is little old topic, but for me it is pretty useful, so tnx for the tip :thumbsup:
robertsams23
10-07-2011, 08:18 AM
You can replace single quotes with two single quotes.
http://asp.net-informations.com/dbpro/asp-single-quotes.htm
rbt.