I have a string from an xml document:
<title type="html">
Is there a way for me to write this string like "<title type="html">"
? I've had similar problems writing javascript as a string but I did see some solutions in the past (which I can't remember)?
Thanks
You need to escape your double quotes..
string blah = "<title type=\"html\">";
OR
string blah = @"<title type=""html"">";
Alternatively you could use single quotes in your tag, which will serve the same purpose.
string blah = "<title type='html'>";
You can escape quotes in a string using a \
String s = "this is my \"data\" in the string";
Escape:
var str = "<font color=\"red\">;";
(Edit: forgot to put proper html chars in!)
Or in javascript you can use single quotes to contain one with doubles:
var str = '<font color="red">';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With