singlenipple

How can I write this HTML code between double cotations in C#

for example:

if ( str.Contains("<img src="/i/ic0.gif" align="absmiddle"> <a href="/cat/")

i tried

if ( str.Contains("<img src=""/i/ic0.gif"" align=""absmiddle""> <a href=""/cat/")

but it didn't work!



Re: Visual C# General HTML code in C#, problems with cotations!

OmegaMan


string.Format(@"<img src={0}{1}{0} align={0}{2}{0}><a href={0}{3}{0}/>", "\"", @"/i/ic0.gif", "absmiddle", "www.microsoft.com");
 


You have to escape the double quote such as "\"", note using the literal character @""" will not work. I have used string.format to pass in the location of the quotes, such preformatting is helpful when combining string elements in a dynamic fashion.





Re: Visual C# General HTML code in C#, problems with cotations!

mcpJim

THX alot.

That's a big help.
I am wondering if I can have your email contact.






Re: Visual C# General HTML code in C#, problems with cotations!

OmegaMan

mcpJim wrote:
THX alot.

That's a big help.
I am wondering if I can have your email contact.



I am not Microsoft Support btw, but my email is on my moniker. My hourly rate is high, (as a contract developer) but for the experience of what I bring to the job it is well worth it. <G>

-OmegaMan