Get plain text from HTML in .NET

后端 未结 5 1742
清酒与你
清酒与你 2020-12-30 21:34

What is the best way to get a plain text string from an HTML string?

public string GetPlainText(string htmlString)
{
    // any .NET built in utility?
}
         


        
5条回答
  •  囚心锁ツ
    2020-12-30 21:53

    There is no built-in solution in the framework.

    If you need to parse HTML I made good experience using a library called HTML Agility Pack.
    It parses an HTML file and provides access to it by DOM, similar to the XML classes.

提交回复
热议问题