How to write a function that can cut a string with HTML tags to an N-length string without breaking HTML tags while doing it.
The returned string doesn’t need to be exactly N characters long. It can cut it before or after tag that is on the edge of N-long string.
Visit <a href="www.htz.hr">Croatia</a> this summer.
CutIt(9) should return
Visit
or
Visit <a href="www.htz.hr">Croatia</a>
I solved the problem so here is the code in c#;