Home Tips & Tricks How to Trim Strings and Keep HTML Tags – Snippet Included

How to Trim Strings and Keep HTML Tags – Snippet Included

There are a lot of methods for trimming strings that take into account the number of chars versus the number of words, but things get a bit complicated when we need to keep the HTML tags at the same time. Don’t they?

How to Trim Strings While Still Keeping HTML Tags