Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to load html code into c# string?

Tags:

html

string

c#

HI, I've got a really seriously question.

I need to send HTML code, so I have to load html into string, and this obvious doesn't work if I can't interpret them well, how can I store it natively?

Thanks for your help

like image 255
user469652 Avatar asked Oct 11 '10 03:10

user469652


People also ask

Can I use HTML in C?

Yes. Using a newer technology called web assembly, you can write c, c++, or rust code such as functions that transpiles into a speedy language that the browser can use.

What is HTML parser in C?

HTML Parser in C/C++ HTML Parser is a program/software by which useful statements can be extracted, leaving html tags (like <h1>, <span>, <p> etc) behind. Examples: Input: <h1>Geeks for Geeks</h1> Output: Geeks for Geeks.


1 Answers

Strings and HTML should be fine. The only complication is escaping, which is made easier using verbatim string literals (@"..."). Then you just double any double-quotes:

string body = @"<html><body>
<a href=""foo.bar"" class=""blap"">blip</a>
...
</body></html>";
like image 199
Marc Gravell Avatar answered Oct 02 '22 09:10

Marc Gravell