开发者

Safely split/paginate an HTML String with ASP.NET

开发者 https://www.devze.com 2022-12-21 16:22 出处:网络
I have rendered one of my controls into a string. I want to safely split the html string. I don\'t want any开发者_运维知识库 hanging html tags. I am working on a pagination control adapter.

I have rendered one of my controls into a string. I want to safely split the html string. I don't want any开发者_运维知识库 hanging html tags. I am working on a pagination control adapter.

How can I split my string, around less than a set number of chars) safely taking HTML into account?


Take a look at HtmlAgilityPack. You can use it to parse and manipulate the html in your string without having to resort to regex.


If you're looking for a nice way to show the HTML code you should try HTML Tidy.
I did not use it with a limitation on the number of charecters per line, but I think HTML Tidy wrap option might get you close to your target.

0

精彩评论

暂无评论...
验证码 换一张
取 消