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.
精彩评论