I have a database of items with XHTML content and I want to display the items with the HTML stripped off (done) and then truncate each item to a maximum length of 100 characters. If the string exceeds 100 characters, I cut it off and insert …
(an ellipsis) at the end.
The problem is that my program doesn't understand HTML entities that are already in the string. E.g. if the string is something & something
, my function may truncate it as something &am...
resulting in invalid XHTML.
What is the best way to go about this problem in ASP.NET/C#?