[Resolved] Store HTML code as string?
Is there a more efficient way of doing this than adding &""""& for every double quotation mark in the html code when building the string? I need to store the HTML code as a string. I am finding "[tablerow]" within an existing document with StreamReader and want to replace it with my string value (html code) when writing it back using stringwriter.
Re: Store HTML code as string?
If you do two quotes "" inside of a quote, then it will read that as a single quote to be put in the quotes. Example:
Code:
Dim s As String
s = String.Format("""{0}""", "somevalue")
MessageBox.Show(s)
Re: Store HTML code as string?
Hmmm. It still does not appear to like that. I am dealing with multiple HTML properties in the string, so there are lots of ""'s. Here's what I've got now:
Code:
strRowToAdd = (String.Format("""{0}""", "<tr><td width="16%"><div align="center" class="style4">[procedure]</div></td><td width="16%"><div align="center" class="style4">[date]</div></td><td width="16%"><div align="center" class="style4">[surgeon]</div></td><td width="16%"><div align="center" class="style4">[surgphone]</div></td><td width="16%"><div align="center" class="style4">[facility]</div></td><td width="20%"><div align="center" class="style4">[postop]</div></td></tr>"))
Thanks for any suggestions. This appears to be fairly tricky. :)
Re: Store HTML code as string?
I ran across this article, but am still a little confused regarding the syntax:
http://www.camelsquadron.com/forums/...?a=topic&t=173
Re: Store HTML code as string?
If you are just building a large string with no replacement values, then forget about String.Format. Inside your string, replace every double quote with two doublequotes.
Code:
"<tr><td width=""16%""><div align=""center"" ...
Re: Store HTML code as string?
Thanks Negative0, I got things working........all the double quotes had me cross-eyed! :)